Add possibility to set serverId as gh-ost argument
Signed-off-by: Cyprian Nosek <cyprian.nosek@pearson.com>
This commit is contained in:
parent
d13049b41e
commit
2bfc672b03
@ -123,6 +123,7 @@ type MigrationContext struct {
|
|||||||
InitiallyDropOldTable bool
|
InitiallyDropOldTable bool
|
||||||
InitiallyDropGhostTable bool
|
InitiallyDropGhostTable bool
|
||||||
CutOverType CutOver
|
CutOverType CutOver
|
||||||
|
ReplicaServerId uint
|
||||||
|
|
||||||
Hostname string
|
Hostname string
|
||||||
AssumeMasterHostname string
|
AssumeMasterHostname string
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/github/gh-ost/go/base"
|
||||||
"github.com/github/gh-ost/go/mysql"
|
"github.com/github/gh-ost/go/mysql"
|
||||||
"github.com/github/gh-ost/go/sql"
|
"github.com/github/gh-ost/go/sql"
|
||||||
|
|
||||||
@ -17,10 +18,6 @@ import (
|
|||||||
"github.com/siddontang/go-mysql/replication"
|
"github.com/siddontang/go-mysql/replication"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
serverId = 99999
|
|
||||||
)
|
|
||||||
|
|
||||||
type GoMySQLReader struct {
|
type GoMySQLReader struct {
|
||||||
connectionConfig *mysql.ConnectionConfig
|
connectionConfig *mysql.ConnectionConfig
|
||||||
binlogSyncer *replication.BinlogSyncer
|
binlogSyncer *replication.BinlogSyncer
|
||||||
@ -28,6 +25,7 @@ type GoMySQLReader struct {
|
|||||||
currentCoordinates mysql.BinlogCoordinates
|
currentCoordinates mysql.BinlogCoordinates
|
||||||
currentCoordinatesMutex *sync.Mutex
|
currentCoordinatesMutex *sync.Mutex
|
||||||
LastAppliedRowsEventHint mysql.BinlogCoordinates
|
LastAppliedRowsEventHint mysql.BinlogCoordinates
|
||||||
|
MigrationContext *base.MigrationContext
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewGoMySQLReader(connectionConfig *mysql.ConnectionConfig) (binlogReader *GoMySQLReader, err error) {
|
func NewGoMySQLReader(connectionConfig *mysql.ConnectionConfig) (binlogReader *GoMySQLReader, err error) {
|
||||||
@ -37,7 +35,10 @@ func NewGoMySQLReader(connectionConfig *mysql.ConnectionConfig) (binlogReader *G
|
|||||||
currentCoordinatesMutex: &sync.Mutex{},
|
currentCoordinatesMutex: &sync.Mutex{},
|
||||||
binlogSyncer: nil,
|
binlogSyncer: nil,
|
||||||
binlogStreamer: nil,
|
binlogStreamer: nil,
|
||||||
|
MigrationContext: base.GetMigrationContext(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
serverId := uint32(binlogReader.MigrationContext.ReplicaServerId)
|
||||||
binlogReader.binlogSyncer = replication.NewBinlogSyncer(serverId, "mysql")
|
binlogReader.binlogSyncer = replication.NewBinlogSyncer(serverId, "mysql")
|
||||||
|
|
||||||
return binlogReader, err
|
return binlogReader, err
|
||||||
|
@ -104,6 +104,8 @@ func main() {
|
|||||||
flag.StringVar(&migrationContext.HooksPath, "hooks-path", "", "directory where hook files are found (default: empty, ie. hooks disabled). Hook files found on this path, and conforming to hook naming conventions will be executed")
|
flag.StringVar(&migrationContext.HooksPath, "hooks-path", "", "directory where hook files are found (default: empty, ie. hooks disabled). Hook files found on this path, and conforming to hook naming conventions will be executed")
|
||||||
flag.StringVar(&migrationContext.HooksHintMessage, "hooks-hint", "", "arbitrary message to be injected to hooks via GH_OST_HOOKS_HINT, for your convenience")
|
flag.StringVar(&migrationContext.HooksHintMessage, "hooks-hint", "", "arbitrary message to be injected to hooks via GH_OST_HOOKS_HINT, for your convenience")
|
||||||
|
|
||||||
|
flag.UintVar(&migrationContext.ReplicaServerId, "replica-server-id", 99999, "server id used by gh-ost process. Default: 99999")
|
||||||
|
|
||||||
maxLoad := flag.String("max-load", "", "Comma delimited status-name=threshold. e.g: 'Threads_running=100,Threads_connected=500'. When status exceeds threshold, app throttles writes")
|
maxLoad := flag.String("max-load", "", "Comma delimited status-name=threshold. e.g: 'Threads_running=100,Threads_connected=500'. When status exceeds threshold, app throttles writes")
|
||||||
criticalLoad := flag.String("critical-load", "", "Comma delimited status-name=threshold, same format as --max-load. When status exceeds threshold, app panics and quits")
|
criticalLoad := flag.String("critical-load", "", "Comma delimited status-name=threshold, same format as --max-load. When status exceeds threshold, app panics and quits")
|
||||||
flag.Int64Var(&migrationContext.CriticalLoadIntervalMilliseconds, "critical-load-interval-millis", 0, "When 0, migration immediately bails out upon meeting critical-load. When non-zero, a second check is done after given interval, and migration only bails out if 2nd check still meets critical load")
|
flag.Int64Var(&migrationContext.CriticalLoadIntervalMilliseconds, "critical-load-interval-millis", 0, "When 0, migration immediately bails out upon meeting critical-load. When non-zero, a second check is done after given interval, and migration only bails out if 2nd check still meets critical load")
|
||||||
|
Loading…
Reference in New Issue
Block a user