Skip to content

Commit

Permalink
test: fix data race in TestAdminCheckGlobalIndexDuringDDL (#53817)
Browse files Browse the repository at this point in the history
close #53802
  • Loading branch information
Defined2014 authored Jun 5, 2024
1 parent a44d409 commit 0c9b665
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/executor/test/admintest/admin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2060,17 +2060,19 @@ func TestAdminCheckGlobalIndexDuringDDL(t *testing.T) {

var schemaMap = make(map[model.SchemaState]struct{})

tk1 := testkit.NewTestKit(t, store)
tk1.MustExec("use test")
hook := &callback.TestDDLCallback{Do: dom}
onJobUpdatedExportedFunc := func(job *model.Job) {
schemaMap[job.SchemaState] = struct{}{}
_, err := tk.Exec("admin check table admin_test")
_, err := tk1.Exec("admin check table admin_test")
assert.NoError(t, err)
}
hook.OnJobUpdatedExported.Store(&onJobUpdatedExportedFunc)

// check table after delete some index key/value pairs.
ddl.MockDMLExecution = func() {
_, err := tk.Exec("admin check table admin_test")
_, err := tk1.Exec("admin check table admin_test")
assert.NoError(t, err)
}

Expand Down

0 comments on commit 0c9b665

Please sign in to comment.