Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: stabilize TestAddIndexMergeConflictWithPessimistic #40975

Merged
merged 3 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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