Skip to content

Commit 695e32d

Browse files
author
Shlomi Noach
authored
Merge branch 'master' into dev_copyrow_hangs
2 parents c7dff99 + 1e067e5 commit 695e32d

File tree

8 files changed

+17
-5
lines changed

8 files changed

+17
-5
lines changed

doc/command-line-flags.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
A more in-depth discussion of various `gh-ost` command line flags: implementation, implication, use cases.
44

5+
### aliyun-rds
6+
7+
Add this flag when executing on Aliyun RDS.
8+
59
### allow-master-master
610

711
See [`--assume-master-host`](#assume-master-host).
@@ -103,6 +107,10 @@ While the ongoing estimated number of rows is still heuristic, it's almost exact
103107

104108
Without this parameter, migration is a _noop_: testing table creation and validity of migration, but not touching data.
105109

110+
### gcp
111+
112+
Add this flag when executing on a 1st generation Google Cloud Platform (GCP).
113+
106114
### heartbeat-interval-millis
107115

108116
Default 100. See [`subsecond-lag`](subsecond-lag.md) for details.

doc/requirements-and-limitations.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ The `SUPER` privilege is required for `STOP SLAVE`, `START SLAVE` operations. Th
3939
- For example, you may not migrate `MyTable` if another table called `MYtable` exists in the same schema.
4040

4141
- Amazon RDS works, but has it's own [limitations](rds.md).
42-
- Google Cloud SQL is currently not supported
42+
- Google Cloud SQL works, `--gcp` flag required.
43+
- Aliyun RDS works, `--aliyun-rds` flag required.
4344

4445
- Multisource is not supported when migrating via replica. It _should_ work (but never tested) when connecting directly to master (`--allow-on-master`)
4546

go/base/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ type MigrationContext struct {
9292
IsTungsten bool
9393
DiscardForeignKeys bool
9494
AliyunRDS bool
95+
GoogleCloudPlatform bool
9596

9697
config ContextConfig
9798
configMutex *sync.Mutex

go/base/utils.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ func ValidateConnection(db *gosql.DB, connectionConfig *mysql.ConnectionConfig,
7575
// swallow this error. not all servers support extra_port
7676
}
7777
// AliyunRDS set users port to "NULL", replace it by gh-ost param
78-
if migrationContext.AliyunRDS {
78+
// GCP set users port to "NULL", replace it by gh-ost param
79+
if migrationContext.AliyunRDS || migrationContext.GoogleCloudPlatform {
7980
port = connectionConfig.Key.Port
8081
} else {
8182
portQuery := `select @@global.port`

go/binlog/gomysql_reader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ func (this *GoMySQLReader) StreamEvents(canStopStreaming func() bool, entriesCha
145145
defer this.currentCoordinatesMutex.Unlock()
146146
this.currentCoordinates.LogFile = string(rotateEvent.NextLogName)
147147
}()
148-
log.Infof("rotate to next log name: %s", rotateEvent.NextLogName)
148+
log.Infof("rotate to next log from %s:%d to %s", this.currentCoordinates.LogFile, int64(ev.Header.LogPos), rotateEvent.NextLogName)
149149
} else if rowsEvent, ok := ev.Event.(*replication.RowsEvent); ok {
150150
if err := this.handleRowsEvent(ev, rowsEvent, entriesChannel); err != nil {
151151
return err

go/cmd/gh-ost/main.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ func main() {
6868
flag.BoolVar(&migrationContext.DiscardForeignKeys, "discard-foreign-keys", false, "DANGER! This flag will migrate a table that has foreign keys and will NOT create foreign keys on the ghost table, thus your altered table will have NO foreign keys. This is useful for intentional dropping of foreign keys")
6969
flag.BoolVar(&migrationContext.SkipForeignKeyChecks, "skip-foreign-key-checks", false, "set to 'true' when you know for certain there are no foreign keys on your table, and wish to skip the time it takes for gh-ost to verify that")
7070
flag.BoolVar(&migrationContext.AliyunRDS, "aliyun-rds", false, "set to 'true' when you execute on Aliyun RDS.")
71+
flag.BoolVar(&migrationContext.GoogleCloudPlatform, "gcp", false, "set to 'true' when you execute on a 1st generation Google Cloud Platform (GCP).")
7172

7273
executeFlag := flag.Bool("execute", false, "actually execute the alter & migrate the table. Default is noop: do some tests and exit")
7374
flag.BoolVar(&migrationContext.TestOnReplica, "test-on-replica", false, "Have the migration run on a replica, not on the master. At the end of migration replication is stopped, and tables are swapped and immediately swap-revert. Replication remains stopped and you can compare the two tables for building trust")

go/logic/applier.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func (this *Applier) InitDBConnections() (err error) {
8989
if err := this.validateAndReadTimeZone(); err != nil {
9090
return err
9191
}
92-
if !this.migrationContext.AliyunRDS {
92+
if !this.migrationContext.AliyunRDS && !this.migrationContext.GoogleCloudPlatform {
9393
if impliedKey, err := mysql.GetInstanceKey(this.db); err != nil {
9494
return err
9595
} else {

go/logic/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func (this *Inspector) InitDBConnections() (err error) {
5353
if err := this.validateConnection(); err != nil {
5454
return err
5555
}
56-
if !this.migrationContext.AliyunRDS {
56+
if !this.migrationContext.AliyunRDS && !this.migrationContext.GoogleCloudPlatform {
5757
if impliedKey, err := mysql.GetInstanceKey(this.db); err != nil {
5858
return err
5959
} else {

0 commit comments

Comments
 (0)