Skip to content

Commit

Permalink
*: fix parallel execution "alter index" (cherry-pick #45582 and fixed…
Browse files Browse the repository at this point in the history
… "alter index" issue) (#45584)

close #45575
  • Loading branch information
zimulala authored Jul 27, 2023
1 parent 2db988e commit 4b8ac1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ddl/db_change_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -946,6 +946,16 @@ func (s *stateChangeSuite) TestShowIndex() {
tk.MustQuery("select key_name, clustered from information_schema.tidb_indexes where table_name = 'tr' order by key_name").Check(testkit.Rows("PRIMARY NO", "vv NO"))
}

func (s *stateChangeSuite) TestParallelAlterIndex() {
sql := "alter table t alter index idx1 invisible;"
f := func(err1, err2 error) {
s.Require().NoError(err1)
s.Require().NoError(err2)
s.tk.MustExec("select * from t")
}
s.testControlParallelExecSQL("", sql, sql, f)
}

func (s *stateChangeSuite) TestParallelAlterModifyColumn() {
sql := "ALTER TABLE t MODIFY COLUMN b int FIRST;"
f := func(err1, err2 error) {
Expand Down
1 change: 1 addition & 0 deletions ddl/index.go
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,7 @@ func checkAlterIndexVisibility(t *meta.Meta, job *model.Job) (*model.TableInfo,
return nil, indexName, invisible, errors.Trace(err)
}
if skip {
job.State = model.JobStateDone
return nil, indexName, invisible, nil
}
return tblInfo, indexName, invisible, nil
Expand Down

0 comments on commit 4b8ac1a

Please sign in to comment.