mirror of https://github.com/tikv/client-go.git
add a failpoint for sleep (#460)
Signed-off-by: ekexium <ekexium@gmail.com> Co-authored-by: Yilin Chen <sticnarf@gmail.com> Co-authored-by: disksing <i@disksing.com>
This commit is contained in:
parent
ec236b6435
commit
e31ba21ae0
|
|
@ -190,6 +190,11 @@ func (action actionPrewrite) handleSingleBatch(c *twoPhaseCommitter, bo *retry.B
|
|||
return errors.New("injected error on prewriting secondary batch")
|
||||
}
|
||||
util.EvalFailpoint("prewriteSecondary") // for other failures like sleep or pause
|
||||
// concurrent failpoint sleep doesn't work as expected. So we need a separate fail point.
|
||||
// `1*sleep()` can block multiple concurrent threads that meet the failpoint.
|
||||
if val, err := util.EvalFailpoint("prewriteSecondarySleep"); err == nil {
|
||||
time.Sleep(time.Millisecond * time.Duration(val.(int)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue