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

ddl: stable create expression index test #29990

Merged
merged 6 commits into from
Nov 23, 2021
Merged
Changes from 3 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
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
wjhuang2016 marked this conversation as resolved.
Show resolved Hide resolved
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
tangenta marked this conversation as resolved.
Show resolved Hide resolved
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