Skip to content

Commit 3b51515

Browse files
tangentaghazalfamilyusa
authored andcommitted
test: stabilize TestAddIndexMergeConflictWithPessimistic (pingcap#40975)
close pingcap#40939
1 parent c20b95d commit 3b51515

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

ddl/indexmergetest/BUILD.bazel

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ go_test(
88
"merge_test.go",
99
],
1010
flaky = True,
11+
race = "on",
1112
shard_count = 4,
1213
deps = [
1314
"//config",

ddl/indexmergetest/merge_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -478,6 +478,7 @@ func TestAddIndexMergeConflictWithPessimistic(t *testing.T) {
478478
callback := &callback.TestDDLCallback{Do: dom}
479479

480480
runPessimisticTxn := false
481+
afterPessDML := make(chan struct{}, 1)
481482
callback.OnJobRunBeforeExported = func(job *model.Job) {
482483
if t.Failed() {
483484
return
@@ -500,6 +501,7 @@ func TestAddIndexMergeConflictWithPessimistic(t *testing.T) {
500501
assert.NoError(t, err)
501502
_, err = tk2.Exec("update t set a = 3 where id = 1;")
502503
assert.NoError(t, err)
504+
afterPessDML <- struct{}{}
503505
}
504506
}
505507
dom.DDL().SetHook(callback)
@@ -515,6 +517,7 @@ func TestAddIndexMergeConflictWithPessimistic(t *testing.T) {
515517
case <-afterCommit:
516518
require.Fail(t, "should be blocked by the pessimistic txn")
517519
}
520+
<-afterPessDML
518521
tk2.MustExec("rollback;")
519522
<-afterCommit
520523
dom.DDL().SetHook(originHook)

0 commit comments

Comments
 (0)