Skip to content

add check index and some other ddl type #21

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

Open
wants to merge 21 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
40 changes: 28 additions & 12 deletions ddl/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,12 @@ func (c *DDLCase) Execute(ctx context.Context, dbss [][]*sql.DB, exeDDLFunc Exec
disableTiKVGC(db)
}
}
// os.Exit(-1)
log.Fatalf("[error] [instance %d] ERROR: %s", i, errors.ErrorStack(err))
if Chaos {
log.Warnf("[error] [instance %d] ERROR: %s", i, errors.ErrorStack(err))
} else {
// os.Exit(-1)
log.Fatalf("[error] [instance %d] ERROR: %s", i, errors.ErrorStack(err))
}
}
}
}(i)
Expand Down Expand Up @@ -149,14 +153,15 @@ func NewDDLCase(cfg *DDLCaseConfig) *DDLCase {
cases := make([]*testCase, cfg.Concurrency)
for i := 0; i < cfg.Concurrency; i++ {
cases[i] = &testCase{
cfg: cfg,
tables: make(map[string]*ddlTestTable),
schemas: make(map[string]*ddlTestSchema),
views: make(map[string]*ddlTestView),
ddlOps: make([]ddlTestOpExecutor, 0),
dmlOps: make([]dmlTestOpExecutor, 0),
caseIndex: i,
stop: 0,
cfg: cfg,
tables: make(map[string]*ddlTestTable),
schemas: make(map[string]*ddlTestSchema),
views: make(map[string]*ddlTestView),
placementPolicies: map[string]*ddlTestPlacementPolicy{},
ddlOps: make([]ddlTestOpExecutor, 0),
dmlOps: make([]dmlTestOpExecutor, 0),
caseIndex: i,
stop: 0,
}
}
b := &DDLCase{
Expand Down Expand Up @@ -417,8 +422,7 @@ func (c *testCase) execute(ctx context.Context, executeDDL ExecuteDDLFunc, exeDM
log.Infof("[ddl] [instance %d] Executing post round operations...", c.caseIndex)

if !c.cfg.MySQLCompatible {
err := c.executeAdminCheck()
if err != nil {
if err := c.executeAdminCheck(); err != nil {
return errors.Trace(err)
}
}
Expand Down Expand Up @@ -601,6 +605,8 @@ func (c *testCase) executeAdminCheck() error {
return nil
}

c.tablesLock.Lock()
defer c.tablesLock.Unlock()
// build SQL
sql := "ADMIN CHECK TABLE "
i := 0
Expand All @@ -610,6 +616,16 @@ func (c *testCase) executeAdminCheck() error {
}
sql += fmt.Sprintf("`%s`", table.name)
i++
for _, index := range table.indexes {
checkIndexSQL := fmt.Sprintf("admin check index `%s` `%s`", table.name, index.name)
_, err := c.pickupDB().Exec(checkIndexSQL)
if ddlIgnoreError(err) {
continue
}
if err != nil {
return errors.Annotatef(err, "Error when executing SQL: %s", checkIndexSQL)
}
}
}
dbIdx := rand.Intn(len(c.dbs))
db := c.dbs[dbIdx]
Expand Down
Loading