Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
191 commits
Select commit Hold shift + click to select a range
28456ed
gh-ost credentials
shlomi-noach Jul 19, 2020
7442311
gh-ost credentials
shlomi-noach Jul 19, 2020
66974c5
setting up ghost and handler
shlomi-noach Jul 19, 2020
839c7e2
executor for gh-ost
shlomi-noach Jul 20, 2020
1f46056
support OnlineSchemaChange on schema/apply
shlomi-noach Jul 20, 2020
7643043
support crearin tempdir and file
shlomi-noach Jul 23, 2020
c4ecf00
generate gh-ost wrapper script on the fly. Use temp dir
shlomi-noach Jul 23, 2020
e19f1f5
ApplyOnlineSchemaChange refactored into Controller
shlomi-noach Jul 23, 2020
8fea6d2
cleanup
shlomi-noach Jul 23, 2020
e4d4724
cleanup and comments
shlomi-noach Jul 23, 2020
e6cb938
typo
shlomi-noach Jul 23, 2020
98c88d7
TODO
shlomi-noach Jul 23, 2020
a5d932a
introducing query hint: VitessOnlineDDLHint
shlomi-noach Jul 23, 2020
a3380f5
IsOnlineSchemaDDL analysis
shlomi-noach Jul 23, 2020
90ded5a
more explicit hint, also comment suggesting it's a hack for now
shlomi-noach Jul 23, 2020
340d93c
building an OnlineDDL plan
shlomi-noach Jul 23, 2020
5beed52
remove online-schema-change code from vtgate and analyzer
shlomi-noach Jul 29, 2020
3892815
Revert "remove online-schema-change code from vtgate and analyzer"
shlomi-noach Aug 2, 2020
53e3456
online_schema_change manages UUID and writes OSC request to global topo
shlomi-noach Aug 2, 2020
ce463d1
vtctl/tablet_executor write online schema change request to global topo
shlomi-noach Aug 2, 2020
4c4ca0b
vtgate intercepts ALTER TABLE statements and writes an online schema …
shlomi-noach Aug 2, 2020
84606d0
refactored TopoPath() function
shlomi-noach Aug 2, 2020
00d22c2
refactor: applying _vt.schema_migrations schema
shlomi-noach Aug 3, 2020
1d04511
refactor: naming
shlomi-noach Aug 3, 2020
1918807
vtctld review migration requests, explodes per shard
shlomi-noach Aug 4, 2020
7517187
adding uuid gomod
shlomi-noach Aug 4, 2020
b33bbc7
vtctld runs schema checks
shlomi-noach Aug 4, 2020
c4fc754
reporting back UUID in response to ALTER TABLE statement
shlomi-noach Aug 4, 2020
e70e09c
/schema-migration/report-status API endpoint
shlomi-noach Aug 4, 2020
12fa9e7
Using latest gh-ost release from openark org
shlomi-noach Aug 5, 2020
1e84a62
cleanup, undo adding fields to proto.SchemaChange
shlomi-noach Aug 6, 2020
324d3a9
cleanup, undo adding fields to proto.SchemaChange
shlomi-noach Aug 6, 2020
6305be0
Cleanup, undo and remove logic from tablet manager path
shlomi-noach Aug 6, 2020
9853008
Cleanup, undo and remove logic from tablet manager path
shlomi-noach Aug 6, 2020
ea0a07c
while still WIP, further logic into online ddl executor
shlomi-noach Aug 6, 2020
c7a000c
updating migration status and timestamp in response to API call
shlomi-noach Aug 6, 2020
9fec402
minor cleanup and rename
shlomi-noach Aug 6, 2020
b0e77e1
cleanup: remove unused code
shlomi-noach Aug 6, 2020
445aebe
Autogenerate gh-ost account and privileges
shlomi-noach Aug 6, 2020
530b63d
no need for gh-ost account in config/rice
shlomi-noach Aug 6, 2020
7a82af0
remove debug info
shlomi-noach Aug 6, 2020
79b2473
remove debug info
shlomi-noach Aug 6, 2020
4d088a7
gh-ost password stored in environment variable, no longer visible as …
shlomi-noach Aug 6, 2020
e71529d
provide gh-ost with DBName
shlomi-noach Aug 6, 2020
bbe0ea7
parsing ALTER ONLINE TABLE statements
shlomi-noach Aug 9, 2020
2f7f667
adding gh-ost binary (compressed)
shlomi-noach Aug 9, 2020
e1e4943
tablet executor writes online DDL UUID to standard output
shlomi-noach Aug 9, 2020
8ac8128
full gh-ost binary
shlomi-noach Aug 9, 2020
e71264f
appending gh-ost binary to vttablet via ricebox, and extracting upon …
shlomi-noach Aug 9, 2020
67e2d21
distinct gh-ost file name
shlomi-noach Aug 9, 2020
ae3c6c3
use included gh-ost binary
shlomi-noach Aug 9, 2020
354549a
extending gh-ost user scope
shlomi-noach Aug 10, 2020
ba0ce5b
naming
shlomi-noach Aug 10, 2020
d33693a
no need to install gh-ost in docker/local
shlomi-noach Aug 10, 2020
e5d008a
Don't lose exit code
shlomi-noach Aug 10, 2020
2e7e0ec
adding column schema_migrations.requested_time
shlomi-noach Aug 10, 2020
2200aa4
ALTER WITH_GHOST TABLE syntax, now finally using Strategy field and c…
shlomi-noach Aug 11, 2020
af107d5
pt-online-schema-change as a resource
shlomi-noach Aug 11, 2020
214b326
refactoring names
shlomi-noach Aug 11, 2020
cea0515
refactoring names
shlomi-noach Aug 11, 2020
e7639d1
extracting table name
shlomi-noach Aug 11, 2020
f257b8f
renamed exec.go to util.go
shlomi-noach Aug 11, 2020
d06f05d
support parseAlterTableOptions() + tests
shlomi-noach Aug 11, 2020
8f9978d
using alterOptions for pt-osc
shlomi-noach Aug 11, 2020
d125366
generalized account
shlomi-noach Aug 11, 2020
66ddc17
POC running pt-online-schema-change
shlomi-noach Aug 11, 2020
f3ba240
make sure to mark migration as failed upon all error paths; fix pt-os…
shlomi-noach Aug 11, 2020
2c2a438
formalize the "template" plugin file
shlomi-noach Aug 11, 2020
2d168bf
refactored ALTER TABLE parsing into schema package
shlomi-noach Aug 11, 2020
2a6d940
vtctl ApplySchema to use same WITH_GHOST and WITH_PT syntax as vtgate…
shlomi-noach Aug 12, 2020
2e33016
sending gh-ost alterOptions only in --alter
shlomi-noach Aug 12, 2020
92515c8
beautify perl
shlomi-noach Aug 12, 2020
626e7ad
fixed perl code. Cleanup temp directory after successful migration
shlomi-noach Aug 12, 2020
ef61396
cleanup
shlomi-noach Aug 12, 2020
a237ba0
pt-online-schema-change: using MYSQL_PWD environment variable. schema…
shlomi-noach Aug 12, 2020
c22146e
vexec for schema-migrations, major refactor
shlomi-noach Aug 12, 2020
31ae7cd
VExecRequest to include workflow, keyspace
shlomi-noach Aug 17, 2020
47390bd
refactor of vexec/planner/plan code
shlomi-noach Aug 17, 2020
a0f7fa3
apply VExec gRPC request on online-ddl executor
shlomi-noach Aug 17, 2020
6dc76a6
plumbing and wiring of VExec
shlomi-noach Aug 17, 2020
fef6137
foce dbName and workflow columns
shlomi-noach Aug 17, 2020
5c69ca7
refactor of vexec planner
shlomi-noach Aug 19, 2020
4c52c41
introducing TabletVExec struct, with utility functionality, used as a…
shlomi-noach Aug 19, 2020
f833b27
refactored aggregation of VExec results into Wrangler
shlomi-noach Aug 19, 2020
03634d9
minor naming refactor
shlomi-noach Aug 19, 2020
44d9173
parser supports online DDL hint options (not used yet): ALTER WITH_GH…
shlomi-noach Aug 20, 2020
ee87c8c
support cancelling migration (where itself tablet has not crashed). S…
shlomi-noach Aug 20, 2020
3a5124f
artifical liveness indicator for pt-osc; marking stale migrations as …
shlomi-noach Aug 20, 2020
ae94b63
minor error message change
shlomi-noach Aug 20, 2020
83ee08a
pt-osc liveness independently of the invoking vttablet: can keep trac…
shlomi-noach Aug 20, 2020
3c26641
tracking liveness of pt-osc from outside the execution flow, so we ca…
shlomi-noach Aug 20, 2020
c997220
change of syntax: ALTER WITH 'gh-ost' TABLE; to reduce new keyword in…
shlomi-noach Aug 23, 2020
7d2aec4
more parser tests
shlomi-noach Aug 23, 2020
75010ae
support for -gh-ost-path and -pt-osc-path, allow the user to override…
shlomi-noach Aug 23, 2020
fe46880
pt-osc migration cancel now also kills the pt-online-schema-change pr…
shlomi-noach Aug 23, 2020
350f551
vttablet cleans up pt-osc triggers after failure
shlomi-noach Aug 23, 2020
4a0f1b0
remove pt-osc triggers from a stale migration
shlomi-noach Aug 24, 2020
737db49
default value for requested_timestamp
shlomi-noach Aug 25, 2020
fdf71b9
forcing a unique table name for migrations for both gh-ost and pt-osc…
shlomi-noach Aug 26, 2020
7decdf4
testing util.go
shlomi-noach Aug 26, 2020
b8f77ed
adding vexec_test.go
shlomi-noach Aug 26, 2020
1f146f4
VExec planner: support template queries; if defined, then user's quer…
shlomi-noach Aug 26, 2020
28c7943
normalizer_test additions
shlomi-noach Aug 26, 2020
8cf7f5b
extacting vexecplan.QueryMatchesTemplates(). Now also used on vttable…
shlomi-noach Aug 26, 2020
56e42e9
refactor: use sqlparser.SplitAndExpression ; move QueryMatchesTemplat…
shlomi-noach Aug 26, 2020
a5950bd
normalize query alphabetically: reorder WHERE 'AND' expressions alph…
shlomi-noach Aug 26, 2020
7592492
executor: simplify update templates
shlomi-noach Aug 26, 2020
077095f
adding normalizer tests for INSERT
shlomi-noach Aug 26, 2020
69737c5
fixing names
shlomi-noach Aug 26, 2020
4d4e748
for vexec, allow returning empty result set (this is not an error). s…
shlomi-noach Aug 27, 2020
99da6ca
TabletVExec supports analyzing and manipulating INSERT columns
shlomi-noach Aug 27, 2020
05c7e47
VExec/plan support INSERT statements
shlomi-noach Aug 27, 2020
6cc7c54
vtctld now pushes new migration to tablets via VExec
shlomi-noach Aug 27, 2020
8b005f8
onlineddl.Executor now accepts INSERT statements, and does not poll f…
shlomi-noach Aug 27, 2020
4560acc
vtctl: support command OnlineDDL
shlomi-noach Aug 27, 2020
c77a2ec
go.mod and go.sum
shlomi-noach Aug 27, 2020
4acf8da
'alter ignore table' syntax no longer supported
shlomi-noach Aug 31, 2020
99ff2eb
vexec: INSERT not supported, by default
shlomi-noach Aug 31, 2020
a31ddb2
artificial 1 second sleep after creating onlineDDL account
shlomi-noach Aug 31, 2020
fefbbed
introducing -online_ddl_check_interval flag (default: 60s)
shlomi-noach Aug 31, 2020
bf87c62
adding initial onlindddl tests
shlomi-noach Aug 31, 2020
44b6cf3
identifieable table name
shlomi-noach Aug 31, 2020
2fe8b2f
using vtctl, rather than vtctlclient
shlomi-noach Aug 31, 2020
8af3bc8
again, using vtctlclient
shlomi-noach Aug 31, 2020
7ccb09b
parser test: use WITH keyword
shlomi-noach Sep 1, 2020
0842ad8
schemamanager: log UUID
shlomi-noach Sep 1, 2020
eea8a0b
accept newlines in SQL
shlomi-noach Sep 1, 2020
885f610
don't match schema
shlomi-noach Sep 1, 2020
37f0cae
print UUID to standard output via logger
shlomi-noach Sep 1, 2020
c513f30
debug info
shlomi-noach Sep 1, 2020
1010baa
debug info
shlomi-noach Sep 1, 2020
f41d665
pint recent migrations
shlomi-noach Sep 1, 2020
9ed1c61
fix alter table test
shlomi-noach Sep 1, 2020
29bd16d
validating 'show recent' output
shlomi-noach Sep 1, 2020
8074747
fixed len comparison
shlomi-noach Sep 1, 2020
6f4ce42
fix match for 'complete' status
shlomi-noach Sep 1, 2020
4fe5428
expect a failed migration
shlomi-noach Sep 1, 2020
b3b6f62
check cancel, retry
shlomi-noach Sep 1, 2020
7c536fe
distinct valid and invalid statements
shlomi-noach Sep 1, 2020
1993cb7
fix retry-migration test
shlomi-noach Sep 1, 2020
64e30da
debug info
shlomi-noach Sep 1, 2020
a65090c
experiment: shard 26 for onlineddl
shlomi-noach Sep 1, 2020
fa0be34
removing new endtoend shard
shlomi-noach Sep 1, 2020
157fb9e
SQLVal -> Literal
shlomi-noach Sep 1, 2020
fb1e8d4
debug info
shlomi-noach Sep 1, 2020
29a4690
correct escaping of regexp
shlomi-noach Sep 1, 2020
71c6094
more permissive max-load for gh-ost
shlomi-noach Sep 2, 2020
dd4f9a3
refactor of online_ddl test, also add throttling and cancelled migration
shlomi-noach Sep 2, 2020
b5ddf9b
testOnlineDDLExecutor in state_manager_test.go
shlomi-noach Sep 2, 2020
b935ebf
analysis with UUID
shlomi-noach Sep 2, 2020
8f72e78
fix search regexp
shlomi-noach Sep 2, 2020
675db49
adding ddle to verifySubcomponent
shlomi-noach Sep 2, 2020
d8f7e69
do not include pt-online-schema-change
shlomi-noach Sep 2, 2020
e59bb9c
reorder state manager test expected values
shlomi-noach Sep 2, 2020
ef64919
added artifacts column, populating with online-ddl table names accord…
shlomi-noach Sep 2, 2020
88a9b96
both gh-ost and pt-osc log to 'migration.log' file
shlomi-noach Sep 9, 2020
86b03d0
moving onlineddl tests to a new shard
shlomi-noach Sep 10, 2020
c19ee6b
fixed merge conflict
shlomi-noach Sep 10, 2020
4f932fc
return results even if rows affected == 0
shlomi-noach Sep 10, 2020
eebdd85
Merge branch 'master' into online-ddl
shlomi-noach Sep 13, 2020
f31545d
merge conflicts
shlomi-noach Sep 23, 2020
289171b
orchestrator failure dependency fix: logic.TopologyRecovery as pointer
shlomi-noach Sep 23, 2020
0a09c22
merged master
shlomi-noach Sep 23, 2020
1afa031
merged master
shlomi-noach Sep 23, 2020
1f89e1c
accepting suggested changes; more fixes as per review
shlomi-noach Sep 23, 2020
fcc3f48
Merge remote-tracking branch 'upstream/master' into online-ddl
shlomi-noach Sep 24, 2020
4f2b70e
fix per review
shlomi-noach Sep 30, 2020
693d9d2
use vterrors
shlomi-noach Sep 30, 2020
b147d29
undo vterrors
shlomi-noach Sep 30, 2020
a378d39
fix builds
shlomi-noach Oct 1, 2020
31872f5
merge master, resovle conflicts
shlomi-noach Oct 1, 2020
a994ca3
Open()/Close() logic
shlomi-noach Oct 1, 2020
b680db7
gh-ost migrations use vttablet throttler
shlomi-noach Oct 1, 2020
6f6eb92
pt-osc migrations use vttablet throttler
shlomi-noach Oct 1, 2020
4579df5
Open() and Close() heartbeatWriter
shlomi-noach Oct 1, 2020
1d61aaf
vttablet throttler feature flag: -enable-lag-throttler
shlomi-noach Oct 4, 2020
2deb3b6
check if ticks is nil
shlomi-noach Oct 4, 2020
f6f2e27
implicit OK check result when throttler is not enabled
shlomi-noach Oct 4, 2020
8505312
fix tests
shlomi-noach Oct 4, 2020
f66c6b1
obviously -enable-lag-throttler for throttler tests...
shlomi-noach Oct 4, 2020
b60c2da
un do repltracker.go changes, because I'm going to merge vttablet-thr…
shlomi-noach Oct 4, 2020
289279b
Merge remote-tracking branch 'origin/vttablet-throttle-feature-flag' …
shlomi-noach Oct 4, 2020
a38856c
moved endtoend online-ddl test out of vtgate and into its own path
shlomi-noach Oct 4, 2020
fe9341e
creating MigrationRequestsPath once, so that ListDir doesn't show error
shlomi-noach Oct 4, 2020
c305450
do not report error if node exists
shlomi-noach Oct 4, 2020
df502e9
fixed missing schema qualifier in init query
shlomi-noach Oct 4, 2020
0064650
functionality from managed-drop-table
shlomi-noach Oct 5, 2020
fb3d39a
text functionality from managed-drop-table
shlomi-noach Oct 5, 2020
075f894
artifact cleanup: RENAME away tables for complete/failed migrations
shlomi-noach Oct 5, 2020
3ad851f
invoking artifact GC at end of migration
shlomi-noach Oct 5, 2020
295b1a8
migration_check_interval now configurable, in particular in favor of …
shlomi-noach Oct 5, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cluster_endtoend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
name: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24]
name: [11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 26]

steps:
- name: Set up Go
Expand Down
3 changes: 2 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ ifndef NOBANNER
echo $$(date): Building source tree
endif
bash ./build.env
go install $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/...
go install $(EXTRA_BUILD_FLAGS) $(VT_GO_PARALLEL) -ldflags "$(shell tools/build_version_flags.sh)" ./go/... && \
(cd go/cmd/vttablet && go run github.com/GeertJohan/go.rice/rice append --exec=../../../bin/vttablet)

debug:
ifndef NOBANNER
Expand Down
2 changes: 0 additions & 2 deletions docker/mini/vttablet-mini-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,6 @@ vttablet \
-init_shard $shard \
-init_tablet_type $tablet_type \
-health_check_interval 5s \
-heartbeat_enable \
-heartbeat_interval 250ms \
-enable_semi_sync \
-enable_replication_reporter \
-backup_storage_implementation file \
Expand Down
2 changes: 0 additions & 2 deletions examples/local/scripts/vttablet-up.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,6 @@ vttablet \
-health_check_interval 5s \
-enable_semi_sync \
-enable_replication_reporter \
-heartbeat_enable \
-heartbeat_interval 250ms \
-backup_storage_implementation file \
-file_backup_storage_root $VTDATAROOT/backups \
-restore_from_backup \
Expand Down
7 changes: 2 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ require (
github.com/Azure/go-autorest/autorest v0.10.0 // indirect
github.com/GeertJohan/go.rice v1.0.0
github.com/PuerkitoBio/goquery v1.5.1
github.com/TylerBrock/colorjson v0.0.0-20180527164720-95ec53f28296
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6
github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878
github.com/aws/aws-sdk-go v1.28.8
Expand All @@ -25,13 +24,14 @@ require (
github.com/evanphx/json-patch v4.5.0+incompatible
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab
github.com/go-sql-driver/mysql v1.5.0
github.com/gogo/protobuf v1.3.1
github.com/gogo/protobuf v1.3.1 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 // indirect
github.com/golang/mock v1.3.1
github.com/golang/protobuf v1.3.2
github.com/golang/snappy v0.0.1
github.com/google/go-cmp v0.4.0
github.com/google/uuid v1.1.1
github.com/googleapis/gnostic v0.2.0 // indirect
github.com/gorilla/websocket v1.4.0
github.com/grpc-ecosystem/go-grpc-middleware v1.1.0
Expand All @@ -52,13 +52,11 @@ require (
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
github.com/krishicks/yaml-patch v0.0.10
github.com/magiconair/properties v1.8.1
github.com/manifoldco/promptui v0.7.0
github.com/martini-contrib/auth v0.0.0-20150219114609-fa62c19b7ae8
github.com/martini-contrib/gzip v0.0.0-20151124214156-6c035326b43f
github.com/martini-contrib/render v0.0.0-20150707142108-ec18f8345a11
github.com/mattn/go-sqlite3 v1.14.0
github.com/minio/minio-go v0.0.0-20190131015406-c8a261de75c1
github.com/mitchellh/go-ps v1.0.0 // indirect
github.com/mitchellh/go-testing-interface v1.14.0 // indirect
github.com/mitchellh/mapstructure v1.2.3 // indirect
github.com/montanaflynn/stats v0.6.3
Expand All @@ -80,7 +78,6 @@ require (
github.com/satori/go.uuid v1.2.0 // indirect
github.com/sjmudd/stopwatch v0.0.0-20170613150411-f380bf8a9be1
github.com/smartystreets/goconvey v1.6.4 // indirect
github.com/spf13/cobra v0.0.5
github.com/stretchr/testify v1.4.0
github.com/tchap/go-patricia v0.0.0-20160729071656-dd168db6051b
github.com/tebeka/selenium v0.9.9
Expand Down
34 changes: 1 addition & 33 deletions go.sum

Large diffs are not rendered by default.

28 changes: 28 additions & 0 deletions go/cmd/vttablet/vttablet.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@ import (
"vitess.io/vitess/go/vt/tableacl/simpleacl"
"vitess.io/vitess/go/vt/topo"
"vitess.io/vitess/go/vt/topo/topoproto"
"vitess.io/vitess/go/vt/vttablet/onlineddl"
"vitess.io/vitess/go/vt/vttablet/tabletmanager"
"vitess.io/vitess/go/vt/vttablet/tabletmanager/vreplication"
"vitess.io/vitess/go/vt/vttablet/tabletserver"
"vitess.io/vitess/go/vt/vttablet/tabletserver/tabletenv"
"vitess.io/vitess/go/yaml2"

rice "github.com/GeertJohan/go.rice"
)

var (
Expand Down Expand Up @@ -77,6 +80,10 @@ func main() {
mysqld := mysqlctl.NewMysqld(config.DB)
servenv.OnClose(mysqld.Close)

if err := extractOnlineDDL(); err != nil {
log.Exitf("failed to extract online DDL binaries: %v", err)
}

// Initialize and start tm.
gRPCPort := int32(0)
if servenv.GRPCPort != nil {
Expand Down Expand Up @@ -157,6 +164,27 @@ func initConfig(tabletAlias *topodatapb.TabletAlias) (*tabletenv.TabletConfig, *
return config, mycnf
}

// extractOnlineDDL extracts the gh-ost binary from this executable. gh-ost is appended
// to vttablet executable by `make build` and via ricebox
func extractOnlineDDL() error {
riceBox, err := rice.FindBox("../../../resources/bin")
if err != nil {
return err
}

if binaryFileName, isOverride := onlineddl.GhostBinaryFileName(); !isOverride {
ghostBinary, err := riceBox.Bytes("gh-ost")
if err != nil {
return err
}
if err := ioutil.WriteFile(binaryFileName, ghostBinary, 0755); err != nil {
return err
}
}

return nil
}

func createTabletServer(config *tabletenv.TabletConfig, ts *topo.Server, tabletAlias *topodatapb.TabletAlias) *tabletserver.TabletServer {
if *tableACLConfig != "" {
// To override default simpleacl, other ACL plugins must set themselves to be default ACL factory
Expand Down
42 changes: 39 additions & 3 deletions go/test/endtoend/cluster/vtctlclient_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,20 @@ func (vtctlclient *VtctlClientProcess) InitShardMaster(Keyspace string, Shard st
return err
}

// ApplySchema applies SQL schema to the keyspace
func (vtctlclient *VtctlClientProcess) ApplySchema(Keyspace string, SQL string) (err error) {
return vtctlclient.ExecuteCommand(
// ApplySchemaWithOutput applies SQL schema to the keyspace
func (vtctlclient *VtctlClientProcess) ApplySchemaWithOutput(Keyspace string, SQL string) (result string, err error) {
return vtctlclient.ExecuteCommandWithOutput(
"ApplySchema",
"-sql", SQL,
Keyspace)
}

// ApplySchema applies SQL schema to the keyspace
func (vtctlclient *VtctlClientProcess) ApplySchema(Keyspace string, SQL string) (err error) {
_, err = vtctlclient.ApplySchemaWithOutput(Keyspace, SQL)
return err
}

// ApplyVSchema applies vitess schema (JSON format) to the keyspace
func (vtctlclient *VtctlClientProcess) ApplyVSchema(Keyspace string, JSON string) (err error) {
return vtctlclient.ExecuteCommand(
Expand All @@ -64,6 +70,36 @@ func (vtctlclient *VtctlClientProcess) ApplyVSchema(Keyspace string, JSON string
)
}

// OnlineDDLShowRecent responds with recent schema migration list
func (vtctlclient *VtctlClientProcess) OnlineDDLShowRecent(Keyspace string) (result string, err error) {
return vtctlclient.ExecuteCommandWithOutput(
"OnlineDDL",
Keyspace,
"show",
"recent",
)
}

// OnlineDDLCancelMigration cancels a given migration uuid
func (vtctlclient *VtctlClientProcess) OnlineDDLCancelMigration(Keyspace, uuid string) (result string, err error) {
return vtctlclient.ExecuteCommandWithOutput(
"OnlineDDL",
Keyspace,
"cancel",
uuid,
)
}

// OnlineDDLRetryMigration retries a given migration uuid
func (vtctlclient *VtctlClientProcess) OnlineDDLRetryMigration(Keyspace, uuid string) (result string, err error) {
return vtctlclient.ExecuteCommandWithOutput(
"OnlineDDL",
Keyspace,
"retry",
uuid,
)
}

// ExecuteCommand executes any vtctlclient command
func (vtctlclient *VtctlClientProcess) ExecuteCommand(args ...string) (err error) {
output, err := vtctlclient.ExecuteCommandWithOutput(args...)
Expand Down
2 changes: 2 additions & 0 deletions go/test/endtoend/cluster/vtctld_process.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ func (vtctld *VtctldProcess) Setup(cell string, extraArgs ...string) (err error)
// hard-code these two soon-to-be deprecated drain values.
"-wait_for_drain_sleep_rdonly", "1s",
"-wait_for_drain_sleep_replica", "1s",
// short online-ddl check interval to hasten tests
"-online_ddl_check_interval", "2s",
"-log_dir", vtctld.LogDir,
"-port", fmt.Sprintf("%d", vtctld.Port),
"-grpc_port", fmt.Sprintf("%d", vtctld.GrpcPort),
Expand Down
Loading