Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: gh-ost no servers (#15281)

p0nyff9567a4b336
diff --git a/backend/component/ghost/config.go b/backend/component/ghost/config.go
index 914b295b73..f6d7fe1540 100644
--- a/backend/component/ghost/config.go
+++ b/backend/component/ghost/config.go
@@ -2,7 +2,6 @@ package ghost
import (
"context"
- "fmt"
"strconv"
"strings"
@@ -176,15 +175,6 @@ func GetUserFlags(flags map[string]string) (*UserFlags, error) {
return f, nil
}
-func getSocketFilename(taskID int) string {
- return fmt.Sprintf("/tmp/gh-ost.%d.sock", taskID)
-}
-
-// GetPostponeFlagFilename gets the postpone flag filename for gh-ost.
-func GetPostponeFlagFilename(taskID int) string {
- return fmt.Sprintf("/tmp/gh-ost.%d.postponeFlag", taskID)
-}
-
// NewMigrationContext is the context for gh-ost migration.
func NewMigrationContext(ctx context.Context, taskID int, database *store.DatabaseMessage, dataSource *store.DataSourceMessage, secret string, tableName string, tmpTableNameSuffix string, statement string, noop bool, flags map[string]string, serverIDOffset uint) (*base.MigrationContext, error) {
password, err := common.Unobfuscate(dataSource.ObfuscatedPassword, secret)
@@ -236,6 +226,7 @@ func NewMigrationContext(ctx context.Context, taskID int, database *store.Databa
migrationContext.InspectorConnectionConfig.Key.Port = port
migrationContext.CliUser = dataSource.Username
migrationContext.CliPassword = password
+ // GhostDatabaseName is our homemade parameter to allow creating temporary tables under another database.
migrationContext.GhostDatabaseName = "bbdataarchive"
migrationContext.DatabaseName = database.DatabaseName
migrationContext.OriginalTableName = tableName
@@ -274,8 +265,8 @@ func NewMigrationContext(ctx context.Context, taskID int, database *store.Databa
}
migrationContext.OriginalTableName = parser.GetExplicitTable()
}
- migrationContext.ServeSocketFile = getSocketFilename(taskID)
- migrationContext.PostponeCutOverFlagFile = GetPostponeFlagFilename(taskID)
+ migrationContext.ServeSocketFile = ""
+ migrationContext.PostponeCutOverFlagFile = ""
migrationContext.TimestampOldTable = defaultConfig.timestampOldTable
migrationContext.SetHeartbeatIntervalMilliseconds(defaultConfig.heartbeatIntervalMilliseconds)
migrationContext.SetNiceRatio(defaultConfig.niceRatio)
diff --git a/backend/runner/taskrun/schema_update_ghost_executor.go b/backend/runner/taskrun/schema_update_ghost_executor.go
index 44de74a3df..37b8da2246 100644
--- a/backend/runner/taskrun/schema_update_ghost_executor.go
+++ b/backend/runner/taskrun/schema_update_ghost_executor.go
@@ -102,8 +102,6 @@ func (exec *SchemaUpdateGhostExecutor) RunOnce(ctx context.Context, driverCtx co
// https://github.com/bytebase/gh-ost2/pull/4
gomysql.DeregisterTLSConfig(migrationContext.Uuid)
}()
- // TODO(p0ny): unset in NewMigrationContext.
- migrationContext.PostponeCutOverFlagFile = ""
migrator := logic.NewMigrator(migrationContext, "bb")
diff --git a/go.mod b/go.mod
index 1f18f18456..65419d3548 100644
--- a/go.mod
+++ b/go.mod
@@ -370,7 +370,7 @@ require (
// fix potential security issue(CVE-2020-26160) introduced by indirect dependency.
replace github.com/dgrijalva/jwt-go => github.com/form3tech-oss/jwt-go v3.2.6-0.20210809144907-32ab6a8243d7+incompatible
-replace github.com/github/gh-ost => github.com/bytebase/gh-ost2 v0.0.0-20250219092957-07c908d5a171
+replace github.com/github/gh-ost => github.com/bytebase/gh-ost2 v0.0.0-20250221080129-d3c3cc3b9931
replace github.com/pingcap/tidb => github.com/bytebase/tidb2 v0.0.0-20231129002249-5bbb6bb83940
diff --git a/go.sum b/go.sum
index 90449f43d2..0bcc8437e7 100644
--- a/go.sum
+++ b/go.sum
@@ -829,8 +829,8 @@ github.com/bytebase/azure-sdk-for-go/sdk/data/azcosmos v0.0.0-20250109032656-87c
github.com/bytebase/azure-sdk-for-go/sdk/data/azcosmos v0.0.0-20250109032656-87cf24d45689/go.mod h1:YwUyrNUtcZcibA99JcfCP6UUp95VVQKO2MJfBzgJDwA=
github.com/bytebase/cosmosdb-parser v0.0.0-20250207092310-6249cdad18cb h1:lGiSU3pSxYP0aa6/qf2IYk5cnSd2diRBHhyYM2Rz5e0=
github.com/bytebase/cosmosdb-parser v0.0.0-20250207092310-6249cdad18cb/go.mod h1:sivaOoKlMrXkuude2VGsKv6p83CRRGgblNfeVKQka/Y=
-github.com/bytebase/gh-ost2 v0.0.0-20250219092957-07c908d5a171 h1:Y3/Wm6WfOQ/HZyc/ewK7iXgVMlTTo1Eb753CnmIiDjk=
-github.com/bytebase/gh-ost2 v0.0.0-20250219092957-07c908d5a171/go.mod h1:X0CGYwIZUnjfrv02/nBlftxqSBMm4mYJzFwiyn2D4d8=
+github.com/bytebase/gh-ost2 v0.0.0-20250221080129-d3c3cc3b9931 h1:w1x0kyXEPMt92sKI9JnqaTXJYE3e/7yeESq6Bjg3rwY=
+github.com/bytebase/gh-ost2 v0.0.0-20250221080129-d3c3cc3b9931/go.mod h1:X0CGYwIZUnjfrv02/nBlftxqSBMm4mYJzFwiyn2D4d8=
github.com/bytebase/go-lsp v0.0.0-20240130071507-c04b5c75010c h1:W832GNANCst4C6TgYbQnKKxbuMZKQxTD4++b3HOuzBo=
github.com/bytebase/go-lsp v0.0.0-20240130071507-c04b5c75010c/go.mod h1:SULmZY7YNBsvNiQbrb/BEDdEJ84TGnfyUQxaHt8t8rY=
github.com/bytebase/go-mssqldb v0.0.0-20240801091126-3ff3ca07d898 h1:0ggqA9XL4yvtePPvRDRYMed3jtdNk4s0o8AMW8uJPSA=