From ed5dd7f0499bbb8b303a8a124b139b023c3583eb Mon Sep 17 00:00:00 2001 From: Shlomi Noach Date: Tue, 7 Feb 2017 09:41:33 +0200 Subject: [PATCH] Collecting and presenting MySQL versions of applier and inspector --- go/base/context.go | 2 ++ go/logic/applier.go | 5 +++-- go/logic/inspect.go | 5 +++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/go/base/context.go b/go/base/context.go index 6142f9c..55c858a 100644 --- a/go/base/context.go +++ b/go/base/context.go @@ -135,7 +135,9 @@ type MigrationContext struct { OriginalBinlogFormat string OriginalBinlogRowImage string InspectorConnectionConfig *mysql.ConnectionConfig + InspectorMySQLVersion string ApplierConnectionConfig *mysql.ConnectionConfig + ApplierMySQLVersion string StartTime time.Time RowCopyStartTime time.Time RowCopyEndTime time.Time diff --git a/go/logic/applier.go b/go/logic/applier.go index d1ad331..d1d7970 100644 --- a/go/logic/applier.go +++ b/go/logic/applier.go @@ -70,14 +70,15 @@ func (this *Applier) InitDBConnections() (err error) { if err := this.readTableColumns(); err != nil { return err } + log.Infof("Applier initiated on %+v, version %+v", this.connectionConfig.ImpliedKey, this.migrationContext.ApplierMySQLVersion) return nil } // validateConnection issues a simple can-connect to MySQL func (this *Applier) validateConnection(db *gosql.DB) error { - query := `select @@global.port` + query := `select @@global.port, @@global.version` var port int - if err := db.QueryRow(query).Scan(&port); err != nil { + if err := db.QueryRow(query).Scan(&port, &this.migrationContext.ApplierMySQLVersion); err != nil { return err } if port != this.connectionConfig.Key.Port { diff --git a/go/logic/inspect.go b/go/logic/inspect.go index 9daef39..862be16 100644 --- a/go/logic/inspect.go +++ b/go/logic/inspect.go @@ -60,6 +60,7 @@ func (this *Inspector) InitDBConnections() (err error) { if err := this.applyBinlogFormat(); err != nil { return err } + log.Infof("Inspector initiated on %+v, version %+v", this.connectionConfig.ImpliedKey, this.migrationContext.InspectorMySQLVersion) return nil } @@ -168,9 +169,9 @@ func (this *Inspector) inspectOriginalAndGhostTables() (err error) { // validateConnection issues a simple can-connect to MySQL func (this *Inspector) validateConnection() error { - query := `select @@global.port` + query := `select @@global.port, @@global.version` var port int - if err := this.db.QueryRow(query).Scan(&port); err != nil { + if err := this.db.QueryRow(query).Scan(&port, &this.migrationContext.InspectorMySQLVersion); err != nil { return err } if port != this.connectionConfig.Key.Port {