Skip to content

Commit 4b8ac1a

Browse files
authored
*: fix parallel execution "alter index" (cherry-pick pingcap#45582 and fixed "alter index" issue) (pingcap#45584)
close pingcap#45575
1 parent 2db988e commit 4b8ac1a

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

ddl/db_change_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -946,6 +946,16 @@ func (s *stateChangeSuite) TestShowIndex() {
946946
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"))
947947
}
948948

949+
func (s *stateChangeSuite) TestParallelAlterIndex() {
950+
sql := "alter table t alter index idx1 invisible;"
951+
f := func(err1, err2 error) {
952+
s.Require().NoError(err1)
953+
s.Require().NoError(err2)
954+
s.tk.MustExec("select * from t")
955+
}
956+
s.testControlParallelExecSQL("", sql, sql, f)
957+
}
958+
949959
func (s *stateChangeSuite) TestParallelAlterModifyColumn() {
950960
sql := "ALTER TABLE t MODIFY COLUMN b int FIRST;"
951961
f := func(err1, err2 error) {

ddl/index.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1002,6 +1002,7 @@ func checkAlterIndexVisibility(t *meta.Meta, job *model.Job) (*model.TableInfo,
10021002
return nil, indexName, invisible, errors.Trace(err)
10031003
}
10041004
if skip {
1005+
job.State = model.JobStateDone
10051006
return nil, indexName, invisible, nil
10061007
}
10071008
return tblInfo, indexName, invisible, nil

0 commit comments

Comments
 (0)