From 47a8ae69cb2a9f18287d34989af18296211fdaab Mon Sep 17 00:00:00 2001 From: glorv Date: Fri, 5 Nov 2021 15:57:06 +0800 Subject: [PATCH] fix --- v4/export/dump.go | 2 +- v4/export/sql.go | 2 +- v4/export/sql_test.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/v4/export/dump.go b/v4/export/dump.go index b2d51a73..9750dc6a 100755 --- a/v4/export/dump.go +++ b/v4/export/dump.go @@ -1045,7 +1045,7 @@ func openSQLDB(d *Dumper) error { // detectServerInfo is an initialization step of Dumper. func detectServerInfo(d *Dumper) error { db, conf := d.dbHandle, d.conf - versionStr, err := SelectVersion(db) + versionStr, err := SelectVersion(d.tctx, db) if err != nil { conf.ServerInfo = ServerInfoUnknown return err diff --git a/v4/export/sql.go b/v4/export/sql.go index 99627ff9..1613a32e 100644 --- a/v4/export/sql.go +++ b/v4/export/sql.go @@ -279,7 +279,7 @@ func ListAllDatabasesTables(tctx *tcontext.Context, db *sql.Conn, databaseNames } // SelectVersion gets the version information from the database server -func SelectVersion(ctx tcontext.Context, db *sql.DB) (string, error) { +func SelectVersion(ctx *tcontext.Context, db *sql.DB) (string, error) { var versionInfo string const queryTiDB = "SELECT tidb_version();" tidbRow := db.QueryRowContext(ctx, queryTiDB) diff --git a/v4/export/sql_test.go b/v4/export/sql_test.go index dabc952a..179dfeec 100644 --- a/v4/export/sql_test.go +++ b/v4/export/sql_test.go @@ -81,7 +81,7 @@ func TestDetectServerInfo(t *testing.T) { mock.ExpectQuery("SELECT version\\(\\);").WillReturnRows(rows) } - verStr, err := SelectVersion(*tcontext.Background(), db) + verStr, err := SelectVersion(tcontext.Background(), db) require.NoError(t, err, comment) info := ParseServerInfo(tcontext.Background(), verStr)