Skip to content

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

chore: update gh-ost fork (#2066)

p0ny9064478c23ab
diff --git a/go.mod b/go.mod
index 042091c102..c1ff2a84a4 100644
--- a/go.mod
+++ b/go.mod
@@ -151,4 +151,4 @@ 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-ost v1.1.3-0.20220630053012-aac285eb72df
+replace github.com/github/gh-ost => github.com/bytebase/gh-ost v1.1.3-0.20220728080340-11d9c9027651
diff --git a/go.sum b/go.sum
index 50b0ecfe37..02ab2847aa 100644
--- a/go.sum
+++ b/go.sum
@@ -170,8 +170,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869 h1:DDGfHa7BWjL4YnC6+E63dPcxHo2sUxDIu8g3QgEJdRY=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
-github.com/bytebase/gh-ost v1.1.3-0.20220630053012-aac285eb72df h1:dATyXNsy6bf2ReGpkX8BerHOzsQNWGfGnr0wq0m06ho=
-github.com/bytebase/gh-ost v1.1.3-0.20220630053012-aac285eb72df/go.mod h1:ejl5ywyKoObDIh0yWDIvU2JFS9I3c12jQPgdSm13sfM=
+github.com/bytebase/gh-ost v1.1.3-0.20220728080340-11d9c9027651 h1:NpoTuRY6Ckj37zTlEax/UTfvHCOdanI5/5dVCarOD18=
+github.com/bytebase/gh-ost v1.1.3-0.20220728080340-11d9c9027651/go.mod h1:/HsnX0+34LXVz3MxtZoW15GiwEOXz/PrEhutjb3icfE=
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5 h1:BjkPE3785EwPhhyuFkbINB+2a1xATwk8SNDWnJiD41g=
github.com/cakturk/go-netstat v0.0.0-20200220111822-e5b49efee7a5/go.mod h1:jtAfVaU/2cu1+wdSRPWE2c1N2qeAA3K4RH9pYgqwets=
github.com/carlmjohnson/flagext v0.21.0/go.mod h1:Eenv0epIUAr4NuedNmkzI8WmBmjIxZC239XcKxYS2ac=
@@ -1209,7 +1209,6 @@ golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201112155050-0c6587e931a9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201203163018-be400aefbc4c/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
-golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
@@ -1451,6 +1450,7 @@ golang.org/x/sys v0.0.0-20220429233432-b5fbb4746d32/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
+golang.org/x/term v0.0.0-20220526004731-065cf7ba2467/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
diff --git a/server/task_check_executor_ghost_sync.go b/server/task_check_executor_ghost_sync.go
index 8a43f2b367..31b4cc47b5 100644
--- a/server/task_check_executor_ghost_sync.go
+++ b/server/task_check_executor_ghost_sync.go
@@ -105,7 +105,7 @@ func (*TaskCheckGhostSyncExecutor) Run(ctx context.Context, server *Server, task
return []api.TaskCheckResult{}, common.Errorf(common.Internal, "failed to create migration context, error: %w", err)
}
- migrator := logic.NewMigrator(migrationContext)
+ migrator := logic.NewMigrator(migrationContext, "bb")
if err := migrator.Migrate(); err != nil {
return []api.TaskCheckResult{
diff --git a/server/task_executor_schema_update_ghost_sync.go b/server/task_executor_schema_update_ghost_sync.go
index 9d023705d5..c61228ba3a 100644
--- a/server/task_executor_schema_update_ghost_sync.go
+++ b/server/task_executor_schema_update_ghost_sync.go
@@ -102,6 +102,8 @@ func newMigrationContext(config ghostConfig) (*base.MigrationContext, error) {
defaultNumRetries = 60
cutoverLockTimeoutSeconds = 3
exponentialBackoffMaxInterval = 64
+ throttleHTTPIntervalMillis = 100
+ throttleHTTPTimeoutMillis = 1000
)
statement := strings.Join(strings.Fields(config.alterStatement), " ")
migrationContext := base.NewMigrationContext()
@@ -127,6 +129,8 @@ func newMigrationContext(config ghostConfig) (*base.MigrationContext, error) {
migrationContext.ConcurrentCountTableRows = concurrentCountTableRows
migrationContext.HooksStatusIntervalSec = hooksStatusIntervalSec
migrationContext.CutOverType = base.CutOverAtomic
+ migrationContext.ThrottleHTTPIntervalMillis = throttleHTTPIntervalMillis
+ migrationContext.ThrottleHTTPTimeoutMillis = throttleHTTPTimeoutMillis
if migrationContext.AlterStatement == "" {
return nil, fmt.Errorf("alterStatement must be provided and must not be empty")
@@ -205,7 +209,7 @@ func (exec *SchemaUpdateGhostSyncTaskExecutor) runGhostMigration(_ context.Conte
ctx, cancel := context.WithCancel(context.Background())
defer cancel()
- migrator := logic.NewMigrator(migrationContext)
+ migrator := logic.NewMigrator(migrationContext, "bb")
go func(ctx context.Context) {
ticker := time.NewTicker(1 * time.Second)