diff --git a/go/binlog/gomysql_reader.go b/go/binlog/gomysql_reader.go index b27de94..53172b1 100644 --- a/go/binlog/gomysql_reader.go +++ b/go/binlog/gomysql_reader.go @@ -26,28 +26,26 @@ type GoMySQLReader struct { currentCoordinates mysql.BinlogCoordinates currentCoordinatesMutex *sync.Mutex LastAppliedRowsEventHint mysql.BinlogCoordinates - MigrationContext *base.MigrationContext } -func NewGoMySQLReader(migrationContext *base.MigrationContext, connectionConfig *mysql.ConnectionConfig) (binlogReader *GoMySQLReader, err error) { +func NewGoMySQLReader(migrationContext *base.MigrationContext) (binlogReader *GoMySQLReader, err error) { binlogReader = &GoMySQLReader{ - connectionConfig: connectionConfig, + connectionConfig: migrationContext.InspectorConnectionConfig, currentCoordinates: mysql.BinlogCoordinates{}, currentCoordinatesMutex: &sync.Mutex{}, binlogSyncer: nil, binlogStreamer: nil, - MigrationContext: migrationContext, } - serverId := uint32(binlogReader.MigrationContext.ReplicaServerId) + serverId := uint32(migrationContext.ReplicaServerId) binlogSyncerConfig := &replication.BinlogSyncerConfig{ ServerID: serverId, Flavor: "mysql", - Host: connectionConfig.Key.Hostname, - Port: uint16(connectionConfig.Key.Port), - User: connectionConfig.User, - Password: connectionConfig.Password, + Host: binlogReader.connectionConfig.Key.Hostname, + Port: uint16(binlogReader.connectionConfig.Key.Port), + User: binlogReader.connectionConfig.User, + Password: binlogReader.connectionConfig.Password, } binlogReader.binlogSyncer = replication.NewBinlogSyncer(binlogSyncerConfig) diff --git a/go/logic/streamer.go b/go/logic/streamer.go index cacf32c..8bf2b4d 100644 --- a/go/logic/streamer.go +++ b/go/logic/streamer.go @@ -122,7 +122,7 @@ func (this *EventsStreamer) InitDBConnections() (err error) { // initBinlogReader creates and connects the reader: we hook up to a MySQL server as a replica func (this *EventsStreamer) initBinlogReader(binlogCoordinates *mysql.BinlogCoordinates) error { - goMySQLReader, err := binlog.NewGoMySQLReader(this.migrationContext, this.migrationContext.InspectorConnectionConfig) + goMySQLReader, err := binlog.NewGoMySQLReader(this.migrationContext) if err != nil { return err }