Skip to content

Commit

Permalink
Removing gh-ost and pt-osc strategies
Browse files Browse the repository at this point in the history
Signed-off-by: Shlomi Noach <[email protected]>
  • Loading branch information
shlomi-noach committed Jan 23, 2025
1 parent 1d57f39 commit 8d67991
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 42 deletions.
8 changes: 2 additions & 6 deletions go/vt/schema/ddl_strategy.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ const (
DDLStrategyVitess DDLStrategy = "vitess"
// DDLStrategyOnline requests vreplication to run the migration
DDLStrategyOnline DDLStrategy = "online"
// DDLStrategyGhost requests gh-ost to run the migration
DDLStrategyGhost DDLStrategy = "gh-ost"
// DDLStrategyPTOSC requests pt-online-schema-change to run the migration
DDLStrategyPTOSC DDLStrategy = "pt-osc"
// DDLStrategyMySQL is a managed migration (queued and executed by the scheduler) but runs through a MySQL `ALTER TABLE`
DDLStrategyMySQL DDLStrategy = "mysql"
)
Expand All @@ -76,7 +72,7 @@ const (
// A strategy is direct if it's not explciitly one of the online DDL strategies
func (s DDLStrategy) IsDirect() bool {
switch s {
case DDLStrategyVitess, DDLStrategyOnline, DDLStrategyGhost, DDLStrategyPTOSC, DDLStrategyMySQL:
case DDLStrategyVitess, DDLStrategyOnline, DDLStrategyMySQL:
return false
}
return true
Expand Down Expand Up @@ -108,7 +104,7 @@ func ParseDDLStrategy(strategyVariable string) (*DDLStrategySetting, error) {
switch strategy := DDLStrategy(strategyName); strategy {
case "": // backward compatiblity and to handle unspecified values
setting.Strategy = DDLStrategyDirect
case DDLStrategyVitess, DDLStrategyOnline, DDLStrategyGhost, DDLStrategyPTOSC, DDLStrategyMySQL, DDLStrategyDirect:
case DDLStrategyVitess, DDLStrategyOnline, DDLStrategyMySQL, DDLStrategyDirect:
setting.Strategy = strategy
default:
return nil, fmt.Errorf("Unknown online DDL strategy: '%v'", strategy)
Expand Down
45 changes: 10 additions & 35 deletions go/vt/schema/ddl_strategy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,9 @@ func TestIsDirect(t *testing.T) {
assert.True(t, DDLStrategyDirect.IsDirect())
assert.False(t, DDLStrategyVitess.IsDirect())
assert.False(t, DDLStrategyOnline.IsDirect())
assert.False(t, DDLStrategyGhost.IsDirect())
assert.False(t, DDLStrategyPTOSC.IsDirect())
assert.True(t, DDLStrategy("").IsDirect())
assert.False(t, DDLStrategy("vitess").IsDirect())
assert.False(t, DDLStrategy("online").IsDirect())
assert.False(t, DDLStrategy("gh-ost").IsDirect())
assert.False(t, DDLStrategy("pt-osc").IsDirect())
assert.False(t, DDLStrategy("mysql").IsDirect())
assert.True(t, DDLStrategy("something").IsDirect())
}
Expand Down Expand Up @@ -217,14 +213,6 @@ func TestParseDDLStrategy(t *testing.T) {
strategyVariable: "online",
strategy: DDLStrategyOnline,
},
{
strategyVariable: "gh-ost",
strategy: DDLStrategyGhost,
},
{
strategyVariable: "pt-osc",
strategy: DDLStrategyPTOSC,
},
{
strategyVariable: "mysql",
strategy: DDLStrategyMySQL,
Expand All @@ -233,32 +221,19 @@ func TestParseDDLStrategy(t *testing.T) {
strategy: DDLStrategyDirect,
},
{
strategyVariable: "gh-ost --max-load=Threads_running=100 --allow-master",
strategy: DDLStrategyGhost,
// These are gh-ost options. Nothing we can do until that changes upstream
options: "--max-load=Threads_running=100 --allow-master",
runtimeOptions: "--max-load=Threads_running=100 --allow-master",
},
{
strategyVariable: "gh-ost --max-load=Threads_running=100 -declarative",
strategy: DDLStrategyGhost,
options: "--max-load=Threads_running=100 -declarative",
runtimeOptions: "--max-load=Threads_running=100",
isDeclarative: true,
},
{
strategyVariable: "gh-ost --declarative --max-load=Threads_running=100",
strategy: DDLStrategyGhost,
options: "--declarative --max-load=Threads_running=100",
runtimeOptions: "--max-load=Threads_running=100",
isDeclarative: true,
strategyVariable: "vitess -singleton",
strategy: DDLStrategyVitess,
options: "-singleton",
runtimeOptions: "",
isSingleton: true,
},
{
strategyVariable: "pt-osc -singleton",
strategy: DDLStrategyPTOSC,
options: "-singleton",
strategyVariable: "vitess --singleton --declarative",
strategy: DDLStrategyVitess,
options: "--singleton --declarative",
runtimeOptions: "",
isSingleton: true,
isDeclarative: true,
},
{
strategyVariable: "vitess --singleton-context",
Expand Down Expand Up @@ -358,7 +333,7 @@ func TestParseDDLStrategy(t *testing.T) {
expectError: "time: invalid duration",
},
{
strategyVariable: "gh-ost --force-cut-over-after=3m",
strategyVariable: "mysql --force-cut-over-after=3m",
strategy: DDLStrategyVitess,
runtimeOptions: "",
expectError: "--force-cut-over-after is only valid in 'vitess' strategy",
Expand Down
2 changes: 1 addition & 1 deletion go/vt/schema/online_ddl_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ func TestOnlineDDLFromCommentedStatement(t *testing.T) {
`alter view v as select * from t`,
`revert vitess_migration '4e5dcf80_354b_11eb_82cd_f875a4d24e90'`,
}
strategySetting := NewDDLStrategySetting(DDLStrategyGhost, `-singleton -declarative --max-load="Threads_running=5"`)
strategySetting := NewDDLStrategySetting(DDLStrategyVitess, `-singleton -declarative --max-load="Threads_running=5"`)
migrationContext := "354b-11eb-82cd-f875a4d24e90"
parser := sqlparser.NewTestParser()
for _, query := range queries {
Expand Down

0 comments on commit 8d67991

Please sign in to comment.