Skip to content

Commit

Permalink
ddl: stable create expression index test (#29990)
Browse files Browse the repository at this point in the history
  • Loading branch information
wjhuang2016 committed Nov 23, 2021
1 parent cc8617e commit d252fd1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,8 @@ func (s *serialTestStateChangeSuite) TestCreateExpressionIndex(c *C) {
stateWriteOnlySQLs := []string{"insert into t values (8, 8)", "begin pessimistic;", "insert into t select * from t", "rollback", "insert into t set b = 9", "update t set b = 7 where a = 2", "delete from t where b = 3"}
stateWriteReorganizationSQLs := []string{"insert into t values (10, 10)", "begin pessimistic;", "insert into t select * from t", "rollback", "insert into t set b = 11", "update t set b = 7 where a = 5", "delete from t where b = 6"}

// If waitReorg timeout, the worker may enter writeReorg more than 2 times.
reorgTime := 0
var checkErr error
d := s.dom.DDL()
originalCallback := d.GetHook()
Expand Down Expand Up @@ -1848,6 +1850,11 @@ func (s *serialTestStateChangeSuite) TestCreateExpressionIndex(c *C) {
}
// (1, 7), (2, 7), (5, 5), (0, 6), (8, 8), (0, 9)
case model.StateWriteReorganization:
if reorgTime < 2 {
reorgTime++
} else {
return
}
for _, sql := range stateWriteReorganizationSQLs {
_, checkErr = tk1.Exec(sql)
if checkErr != nil {
Expand Down Expand Up @@ -1880,6 +1887,8 @@ func (s *serialTestStateChangeSuite) TestCreateUniqueExpressionIndex(c *C) {

stateDeleteOnlySQLs := []string{"insert into t values (5, 5)", "begin pessimistic;", "insert into t select * from t", "rollback", "insert into t set b = 6", "update t set b = 7 where a = 1", "delete from t where b = 4"}

// If waitReorg timeout, the worker may enter writeReorg more than 2 times.
reorgTime := 0
var checkErr error
d := s.dom.DDL()
originalCallback := d.GetHook()
Expand Down Expand Up @@ -1932,6 +1941,11 @@ func (s *serialTestStateChangeSuite) TestCreateUniqueExpressionIndex(c *C) {
}
// (1, 7), (2, 7), (5, 5), (0, 6), (8, 8), (0, 9)
case model.StateWriteReorganization:
if reorgTime < 2 {
reorgTime++
} else {
return
}
_, checkErr = tk1.Exec("insert into t values (10, 10) on duplicate key update a = 11")
if checkErr != nil {
return
Expand Down

0 comments on commit d252fd1

Please sign in to comment.