diff --git a/ddl/db_change_test.go b/ddl/db_change_test.go index 77493bd2b5..c3a9c6c66a 100644 --- a/ddl/db_change_test.go +++ b/ddl/db_change_test.go @@ -1321,6 +1321,8 @@ func (s *testStateChangeSuite) TestParallelDDLBeforeRunDDLJob(c *C) { se.SetConnectionID(firstConnID) _, err1 := se.Execute(context.Background(), "alter table test_table drop column c2") c.Assert(err1, IsNil) + // Sleep a while to make sure the connection 2 break out the first for loop in OnGetInfoSchemaExported, otherwise atomic.LoadInt32(&sessionCnt) == 2 will be false forever. + time.Sleep(100 * time.Millisecond) atomic.StoreInt32(&sessionCnt, finishedCnt) }() go func() {