Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
chore: update gh-ost check order (#15288)
boojackcd63f13e213c
diff --git a/backend/plugin/advisor/mysql/advisor_online_migration.go b/backend/plugin/advisor/mysql/advisor_online_migration.goindex 3e9ca30713..61ba88e724 100644--- a/backend/plugin/advisor/mysql/advisor_online_migration.go+++ b/backend/plugin/advisor/mysql/advisor_online_migration.go@@ -56,8 +56,23 @@ func (*OnlineMigrationAdvisor) Check(ctx advisor.Context, _ string) ([]*storepb.dbSchema := model.NewDBSchema(ctx.DBSchema, nil, nil)title := string(ctx.Rule.Type)+ // Check gh-ost database existence first if the change type is gh-ost.+ if ctx.ChangeType == storepb.PlanCheckRunConfig_DDL_GHOST {+ if !advisor.DatabaseExists(ctx, ghostDatabaseName) {+ return []*storepb.Advice{+ {Status: level,+ Title: title,+ Content: fmt.Sprintf("Needs database %q to save temporary data for online migration but it does not exist", ghostDatabaseName),+ Code: advisor.DatabaseNotExists.Int32(),+ StartPosition: &storepb.Position{+ Line: 0,+ }},+ }, nil+ }+ }+var adviceList []*storepb.Advice- // Check statements first.+ // Check statements.for _, stmt := range stmtList {checker := &useGhostChecker{currentDatabase: ctx.CurrentDatabase,@@ -89,23 +104,6 @@ func (*OnlineMigrationAdvisor) Check(ctx advisor.Context, _ string) ([]*storepb.}}- // Check if the ghost database exists if there is any statement that needs online migration and gh-ost is enabled.- if len(adviceList) > 0 && ctx.ChangeType == storepb.PlanCheckRunConfig_DDL_GHOST {- if !advisor.DatabaseExists(ctx, ghostDatabaseName) {- // Prepend the advice.- adviceList = append([]*storepb.Advice{- {Status: level,- Title: title,- Content: fmt.Sprintf("Needs database %q to save temporary data for online migration but it does not exist", ghostDatabaseName),- Code: advisor.DatabaseNotExists.Int32(),- StartPosition: &storepb.Position{- Line: 0,- }},- }, adviceList...)- return adviceList, nil- }- }-// More than one statements need online migration.// Advise running each statement in separate issues.if len(adviceList) > 1 {