Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
fix(executor): update task type handling for database tasks (#17068)
h3n4l4e26d99ae99f
diff --git a/backend/runner/taskrun/executor.go b/backend/runner/taskrun/executor.goindex 4fcf34327d..5cf4a65dd6 100644--- a/backend/runner/taskrun/executor.go+++ b/backend/runner/taskrun/executor.go@@ -432,7 +432,7 @@ func beginMigration(ctx context.Context, stores *store.Store, mc *migrateContext// sync historyvar syncHistoryPrevUID *int64- if needDump(mc.task.Type) {+ if needDump(mc.task.Type, mc.instance) {opts.LogDatabaseSyncStart()syncHistoryPrev, err := mc.syncer.SyncDatabaseSchemaToHistory(ctx, mc.database)if err != nil {@@ -474,7 +474,7 @@ func endMigration(ctx context.Context, storeInstance *store.Store, mc *migrateCoUID: mc.changelog,}- if needDump(mc.task.Type) {+ if needDump(mc.task.Type, mc.instance) {syncHistory, err := mc.syncer.SyncDatabaseSchemaToHistory(ctx, mc.database)if err != nil {return errors.Wrapf(err, "failed to sync database metadata and schema")@@ -595,18 +595,23 @@ func isChangeDatabaseTask(taskType storepb.Task_Type) bool {}}-func needDump(taskType storepb.Task_Type) bool {+func needDump(taskType storepb.Task_Type, instance *store.InstanceMessage) bool {+ // Skip dump for TiDB DML operations+ if taskType == storepb.Task_DATABASE_DATA_UPDATE && instance.Metadata.GetEngine() == storepb.Engine_TIDB {+ return false+ }+//exhaustive:enforceswitch taskType {casestorepb.Task_DATABASE_SCHEMA_UPDATE,storepb.Task_DATABASE_SCHEMA_UPDATE_SDL,- storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST:+ storepb.Task_DATABASE_SCHEMA_UPDATE_GHOST,+ storepb.Task_DATABASE_CREATE,+ storepb.Task_DATABASE_DATA_UPDATE:return truecasestorepb.Task_TASK_TYPE_UNSPECIFIED,- storepb.Task_DATABASE_CREATE,- storepb.Task_DATABASE_DATA_UPDATE,storepb.Task_DATABASE_EXPORT:return falsedefault:diff --git a/backend/tests/schema_update_test.go b/backend/tests/schema_update_test.goindex eab8c44397..b1a7467018 100644--- a/backend/tests/schema_update_test.go+++ b/backend/tests/schema_update_test.go@@ -99,8 +99,8 @@ func TestSchemaAndDataUpdate(t *testing.T) {{Type: v1pb.Changelog_DATA,Status: v1pb.Changelog_DONE,- Schema: "",- PrevSchema: "",+ Schema: dumpedSchema,+ PrevSchema: dumpedSchema,Version: "",},{