Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
feat: add ghost flags (#15291)
p0ny0fcd88d62bab
diff --git a/backend/component/ghost/config.go b/backend/component/ghost/config.goindex f6d7fe1540..961fb3b1eb 100644--- a/backend/component/ghost/config.go+++ b/backend/component/ghost/config.go@@ -16,6 +16,7 @@ import ()var defaultConfig = struct {+ attemptInstantDDL boolallowedRunningOnMaster boolconcurrentCountTableRows booltimestampOldTable bool@@ -31,6 +32,7 @@ var defaultConfig = struct {throttleHTTPIntervalMillis int64throttleHTTPTimeoutMillis int64}{+ attemptInstantDDL: true, // attempt-instant-ddlallowedRunningOnMaster: true, // allow-on-masterconcurrentCountTableRows: true, // concurrent-rowcounttimestampOldTable: true, // doesn't have a gh-ost cli flag counterpart@@ -60,6 +62,8 @@ type UserFlags struct {assumeRBR *boolheartbeatIntervalMillis *int64niceRatio *float64+ throttleControlReplicas *string+ attemptInstantDDL *bool}var knownKeys = map[string]bool{@@ -75,6 +79,8 @@ var knownKeys = map[string]bool{"assume-rbr": true,"heartbeat-interval-millis": true,"nice-ratio": true,+ "throttle-control-replicas": true,+ "attempt-instant-ddl": true,}func GetUserFlags(flags map[string]string) (*UserFlags, error) {@@ -172,6 +178,16 @@ func GetUserFlags(flags map[string]string) (*UserFlags, error) {}f.niceRatio = &niceRatio}+ if v, ok := flags["throttle-control-replicas"]; ok {+ f.throttleControlReplicas = &v+ }+ if v, ok := flags["attempt-instant-ddl"]; ok {+ attemptInstantDDL, err := strconv.ParseBool(v)+ if err != nil {+ return nil, errors.Wrapf(err, "failed to convert attempt-instant-ddl %q to bool", v)+ }+ f.attemptInstantDDL = &attemptInstantDDL+ }return f, nil}@@ -240,6 +256,7 @@ func NewMigrationContext(ctx context.Context, taskID int, database *store.Databaif err := migrationContext.SetConnectionConfig(""); err != nil {return nil, err}+ migrationContext.AttemptInstantDDL = defaultConfig.attemptInstantDDLmigrationContext.AllowedRunningOnMaster = defaultConfig.allowedRunningOnMastermigrationContext.ConcurrentCountTableRows = defaultConfig.concurrentCountTableRowsmigrationContext.HooksStatusIntervalSec = defaultConfig.hooksStatusIntervalSec@@ -286,6 +303,9 @@ func NewMigrationContext(ctx context.Context, taskID int, database *store.Databaif err != nil {return nil, errors.Wrapf(err, "failed to get user flags")}+ if v := userFlags.attemptInstantDDL; v != nil {+ migrationContext.AttemptInstantDDL = *v+ }if v := userFlags.maxLoad; v != nil {if err := migrationContext.ReadMaxLoad(*v); err != nil {return nil, errors.Wrapf(err, "failed to parse max load %q", *v)@@ -328,6 +348,11 @@ func NewMigrationContext(ctx context.Context, taskID int, database *store.Databaif v := userFlags.niceRatio; v != nil {migrationContext.SetNiceRatio(*v)}+ if v := userFlags.throttleControlReplicas; v != nil {+ if err := migrationContext.ReadThrottleControlReplicaKeys(*v); err != nil {+ return nil, errors.Wrapf(err, "failed to set throttleControlReplicas")+ }+ }// Uses specified port. GCP, Aliyun, Azure are equivalent here.migrationContext.GoogleCloudPlatform = truediff --git a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/FlagsForm/constants.ts b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/FlagsForm/constants.tsindex 28a543dcbc..8d1635ba66 100644--- a/frontend/src/components/IssueV1/components/Sidebar/GhostSection/FlagsForm/constants.ts+++ b/frontend/src/components/IssueV1/components/Sidebar/GhostSection/FlagsForm/constants.ts@@ -7,18 +7,20 @@ export type GhostParameter<T extends GhostParameterType = any> = {};export const SupportedGhostParameters: GhostParameter[] = [- { key: "max-load", type: "string", defaults: "" },+ { key: "attempt-instant-ddl", type: "bool", defaults: "true"},+ { key: "allow-on-master", type: "bool", defaults: "true" },+ { key: "assume-rbr", type: "bool", defaults: "false" },{ key: "chunk-size", type: "int", defaults: "1000" },- { key: "dml-batch-size", type: "int", defaults: "10" },- { key: "default-retries", type: "int", defaults: "60" },{ key: "cut-over-lock-timeout-seconds", type: "int", defaults: "10" },+ { key: "default-retries", type: "int", defaults: "60" },+ { key: "dml-batch-size", type: "int", defaults: "10" },{ key: "exponential-backoff-max-interval", type: "int", defaults: "64" },- { key: "max-lag-millis", type: "int", defaults: "1500" },- { key: "allow-on-master", type: "bool", defaults: "true" },- { key: "switch-to-rbr", type: "bool", defaults: "false" },- { key: "assume-rbr", type: "bool", defaults: "false" },{ key: "heart-beat-interval-millis", type: "int", defaults: "100" },+ { key: "max-load", type: "string", defaults: "" },+ { key: "max-lag-millis", type: "int", defaults: "1500" },{ key: "nice-ratio", type: "float", defaults: "0" },+ { key: "switch-to-rbr", type: "bool", defaults: "false" },+ { key: "throttle-control-replicas", type: "string", defaults: ""},];export const isBoolParameter = (