From 8a1212efa0ebd58c9422503667631c508833dafc Mon Sep 17 00:00:00 2001 From: meiji163 Date: Sat, 7 Oct 2023 21:02:30 -0700 Subject: [PATCH] parse binlog timestamp in UTC --- go/binlog/gomysql_reader.go | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/go/binlog/gomysql_reader.go b/go/binlog/gomysql_reader.go index 8cf35eabe..79f258e3a 100644 --- a/go/binlog/gomysql_reader.go +++ b/go/binlog/gomysql_reader.go @@ -13,6 +13,8 @@ import ( "github.com/github/gh-ost/go/mysql" "github.com/github/gh-ost/go/sql" + "time" + gomysql "github.com/go-mysql-org/go-mysql/mysql" "github.com/go-mysql-org/go-mysql/replication" "golang.org/x/net/context" @@ -36,15 +38,16 @@ func NewGoMySQLReader(migrationContext *base.MigrationContext) *GoMySQLReader { currentCoordinates: mysql.BinlogCoordinates{}, currentCoordinatesMutex: &sync.Mutex{}, binlogSyncer: replication.NewBinlogSyncer(replication.BinlogSyncerConfig{ - ServerID: uint32(migrationContext.ReplicaServerId), - Flavor: gomysql.MySQLFlavor, - Host: connectionConfig.Key.Hostname, - Port: uint16(connectionConfig.Key.Port), - User: connectionConfig.User, - Password: connectionConfig.Password, - TLSConfig: connectionConfig.TLSConfig(), - UseDecimal: true, - MaxReconnectAttempts: migrationContext.BinlogSyncerMaxReconnectAttempts, + ServerID: uint32(migrationContext.ReplicaServerId), + Flavor: gomysql.MySQLFlavor, + Host: connectionConfig.Key.Hostname, + Port: uint16(connectionConfig.Key.Port), + User: connectionConfig.User, + Password: connectionConfig.Password, + TLSConfig: connectionConfig.TLSConfig(), + UseDecimal: true, + MaxReconnectAttempts: migrationContext.BinlogSyncerMaxReconnectAttempts, + TimestampStringLocation: time.UTC, }), } }