Skip to content

Commit

Permalink
rename failpoint params
Browse files Browse the repository at this point in the history
  • Loading branch information
djshow832 committed Dec 9, 2021
1 parent 5e8bddd commit ed05054
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7311,7 +7311,7 @@ func (s *testSerialDBSuite) TestCancelJobWriteConflict(c *C) {
hook.OnJobRunBeforeExported = func(job *model.Job) {
if job.Type == model.ActionAddIndex && job.State == model.JobStateRunning && job.SchemaState == model.StateWriteReorganization {
stmt := fmt.Sprintf("admin cancel ddl jobs %d", job.ID)
c.Assert(failpoint.Enable("github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn", `return("everytime")`), IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn", `return("no_retry")`), IsNil)
defer func() { c.Assert(failpoint.Disable("github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn"), IsNil) }()
rs, cancelErr = tk1.Se.Execute(context.Background(), stmt)
}
Expand All @@ -7325,7 +7325,7 @@ func (s *testSerialDBSuite) TestCancelJobWriteConflict(c *C) {
if job.Type == model.ActionAddIndex && job.State == model.JobStateRunning && job.SchemaState == model.StateWriteReorganization {
jobID = job.ID
stmt := fmt.Sprintf("admin cancel ddl jobs %d", job.ID)
c.Assert(failpoint.Enable("github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn", `return("once")`), IsNil)
c.Assert(failpoint.Enable("github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn", `return("retry_once")`), IsNil)
defer func() { c.Assert(failpoint.Disable("github.com/pingcap/tidb/kv/mockCommitErrorInNewTxn"), IsNil) }()
rs, cancelErr = tk1.Se.Execute(context.Background(), stmt)
}
Expand Down
4 changes: 2 additions & 2 deletions kv/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,11 @@ func RunInNewTxn(ctx context.Context, store Storage, retryable bool, f func(ctx
failpoint.Inject("mockCommitErrorInNewTxn", func(val failpoint.Value) {
if v := val.(string); len(v) > 0 {
switch v {
case "once":
case "retry_once":
if i == 0 {
err = ErrTxnRetryable
}
case "everytime":
case "no_retry":
failpoint.Return(errors.New("mock commit error"))
}
}
Expand Down

0 comments on commit ed05054

Please sign in to comment.