Skip to content

Commit

Permalink
test: stabilize TestAddIndexMergeConflictWithPessimistic (#40975)
Browse files Browse the repository at this point in the history
close #40939
  • Loading branch information
tangenta authored Feb 2, 2023
1 parent d0d321f commit c215108
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions ddl/indexmergetest/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ go_test(
"merge_test.go",
],
flaky = True,
race = "on",
shard_count = 4,
deps = [
"//config",
Expand Down
3 changes: 3 additions & 0 deletions ddl/indexmergetest/merge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ func TestAddIndexMergeConflictWithPessimistic(t *testing.T) {
callback := &callback.TestDDLCallback{Do: dom}

runPessimisticTxn := false
afterPessDML := make(chan struct{}, 1)
callback.OnJobRunBeforeExported = func(job *model.Job) {
if t.Failed() {
return
Expand All @@ -500,6 +501,7 @@ func TestAddIndexMergeConflictWithPessimistic(t *testing.T) {
assert.NoError(t, err)
_, err = tk2.Exec("update t set a = 3 where id = 1;")
assert.NoError(t, err)
afterPessDML <- struct{}{}
}
}
dom.DDL().SetHook(callback)
Expand All @@ -515,6 +517,7 @@ func TestAddIndexMergeConflictWithPessimistic(t *testing.T) {
case <-afterCommit:
require.Fail(t, "should be blocked by the pessimistic txn")
}
<-afterPessDML
tk2.MustExec("rollback;")
<-afterCommit
dom.DDL().SetHook(originHook)
Expand Down

0 comments on commit c215108

Please sign in to comment.