diff --git a/pkg/ddl/cluster.go b/pkg/ddl/cluster.go index 3a7093befb444..46a55598944ea 100644 --- a/pkg/ddl/cluster.go +++ b/pkg/ddl/cluster.go @@ -39,6 +39,7 @@ import ( "github.com/pingcap/tidb/pkg/sessionctx/variable" statsutil "github.com/pingcap/tidb/pkg/statistics/handle/util" "github.com/pingcap/tidb/pkg/tablecodec" + "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util/filter" "github.com/pingcap/tidb/pkg/util/gcutil" "github.com/pingcap/tidb/pkg/util/logutil" @@ -251,7 +252,7 @@ func checkAndSetFlashbackClusterInfo(se sessionctx.Context, d *ddlCtx, t *meta.M return errors.Trace(err) } - flashbackTSString := oracle.GetTimeFromTS(flashbackTS).String() + flashbackTSString := oracle.GetTimeFromTS(flashbackTS).Format(types.TimeFSPFormat) // Check if there is an upgrade during [flashbackTS, now) sql := fmt.Sprintf("select VARIABLE_VALUE from mysql.tidb as of timestamp '%s' where VARIABLE_NAME='tidb_server_version'", flashbackTSString) diff --git a/pkg/ddl/cluster_test.go b/pkg/ddl/cluster_test.go index d0fd1a7a1554c..8a486aaec072c 100644 --- a/pkg/ddl/cluster_test.go +++ b/pkg/ddl/cluster_test.go @@ -30,6 +30,7 @@ import ( "github.com/pingcap/tidb/pkg/sessionctx/variable" "github.com/pingcap/tidb/pkg/tablecodec" "github.com/pingcap/tidb/pkg/testkit" + "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util/dbterror" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -101,7 +102,7 @@ func TestFlashbackCloseAndResetPDSchedule(t *testing.T) { ts, err := tk.Session().GetStore().GetOracle().GetTimestamp(context.Background(), &oracle.Option{}) require.NoError(t, err) - tk.MustGetErrCode(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts)), errno.ErrCancelledDDLJob) + tk.MustGetErrCode(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat)), errno.ErrCancelledDDLJob) dom.DDL().SetHook(originHook) finishValue, err := infosync.GetPDScheduleConfig(context.Background()) @@ -142,7 +143,7 @@ func TestAddDDLDuringFlashback(t *testing.T) { } } dom.DDL().SetHook(hook) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) dom.DDL().SetHook(originHook) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/mockFlashbackTest")) @@ -193,7 +194,7 @@ func TestGlobalVariablesOnFlashback(t *testing.T) { tk.MustExec("set global tidb_super_read_only = off") tk.MustExec("set global tidb_ttl_job_enable = on") - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) rs, err := tk.Exec("show variables like 'tidb_super_read_only'") require.NoError(t, err) @@ -212,7 +213,7 @@ func TestGlobalVariablesOnFlashback(t *testing.T) { ts, err = tk.Session().GetStore().GetOracle().GetTimestamp(context.Background(), &oracle.Option{}) require.NoError(t, err) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) rs, err = tk.Exec("show variables like 'tidb_super_read_only'") require.NoError(t, err) require.Equal(t, tk.ResultSetToResult(rs, "").Rows()[0][1], variable.On) @@ -252,7 +253,7 @@ func TestCancelFlashbackCluster(t *testing.T) { }) dom.DDL().SetHook(hook) tk.MustExec("set global tidb_ttl_job_enable = on") - tk.MustGetErrCode(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts)), errno.ErrCancelledDDLJob) + tk.MustGetErrCode(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat)), errno.ErrCancelledDDLJob) hook.MustCancelDone(t) rs, err := tk.Exec("show variables like 'tidb_ttl_job_enable'") @@ -264,7 +265,7 @@ func TestCancelFlashbackCluster(t *testing.T) { return job.SchemaState == model.StateWriteReorganization }) dom.DDL().SetHook(hook) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) hook.MustCancelFailed(t) rs, err = tk.Exec("show variables like 'tidb_ttl_job_enable'") diff --git a/pkg/ddl/tests/tiflash/BUILD.bazel b/pkg/ddl/tests/tiflash/BUILD.bazel index f0117788b0599..1668f154eaf30 100644 --- a/pkg/ddl/tests/tiflash/BUILD.bazel +++ b/pkg/ddl/tests/tiflash/BUILD.bazel @@ -28,6 +28,7 @@ go_test( "//pkg/testkit", "//pkg/testkit/external", "//pkg/testkit/testsetup", + "//pkg/types", "//pkg/util", "//pkg/util/logutil", "//pkg/util/sqlkiller", diff --git a/pkg/ddl/tests/tiflash/ddl_tiflash_test.go b/pkg/ddl/tests/tiflash/ddl_tiflash_test.go index 948b277a6f68c..06d850a8d9497 100644 --- a/pkg/ddl/tests/tiflash/ddl_tiflash_test.go +++ b/pkg/ddl/tests/tiflash/ddl_tiflash_test.go @@ -44,6 +44,7 @@ import ( "github.com/pingcap/tidb/pkg/tablecodec" "github.com/pingcap/tidb/pkg/testkit" "github.com/pingcap/tidb/pkg/testkit/external" + "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util" "github.com/pingcap/tidb/pkg/util/logutil" "github.com/pingcap/tidb/pkg/util/sqlkiller" @@ -471,8 +472,8 @@ func TestTiFlashFlashbackCluster(t *testing.T) { }() errorMsg := fmt.Sprintf("[ddl:-1]Detected unsupported DDL job type(%s) during [%s, now), can't do flashback", - model.ActionSetTiFlashReplica.String(), oracle.GetTimeFromTS(ts).String()) - tk.MustGetErrMsg(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts)), errorMsg) + model.ActionSetTiFlashReplica.String(), oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat)) + tk.MustGetErrMsg(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat)), errorMsg) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/mockFlashbackTest")) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS")) diff --git a/pkg/executor/recover_test.go b/pkg/executor/recover_test.go index c57c71dc61af9..ca5d016737a36 100644 --- a/pkg/executor/recover_test.go +++ b/pkg/executor/recover_test.go @@ -27,6 +27,7 @@ import ( "github.com/pingcap/tidb/pkg/parser/auth" "github.com/pingcap/tidb/pkg/sessionctx/variable" "github.com/pingcap/tidb/pkg/testkit" + "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/pkg/util/dbterror" "github.com/pingcap/tidb/pkg/util/gcutil" "github.com/stretchr/testify/require" @@ -376,15 +377,15 @@ func TestRecoverClusterMeetError(t *testing.T) { nowTS, err := tk.Session().GetStore().GetOracle().GetTimestamp(context.Background(), &oracle.Option{}) require.NoError(t, err) tk.MustExec("truncate table mysql.stats_meta") - errorMsg := fmt.Sprintf("[ddl:-1]Detected modified system table during [%s, now), can't do flashback", oracle.GetTimeFromTS(nowTS).String()) - tk.MustGetErrMsg(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(nowTS)), errorMsg) + errorMsg := fmt.Sprintf("[ddl:-1]Detected modified system table during [%s, now), can't do flashback", oracle.GetTimeFromTS(nowTS).Format(types.TimeFSPFormat)) + tk.MustGetErrMsg(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(nowTS).Format(types.TimeFSPFormat)), errorMsg) // update tidb_server_version nowTS, err = tk.Session().GetStore().GetOracle().GetTimestamp(context.Background(), &oracle.Option{}) require.NoError(t, err) tk.MustExec("update mysql.tidb set VARIABLE_VALUE=VARIABLE_VALUE+1 where VARIABLE_NAME='tidb_server_version'") - errorMsg = fmt.Sprintf("[ddl:-1]Detected TiDB upgrade during [%s, now), can't do flashback", oracle.GetTimeFromTS(nowTS).String()) - tk.MustGetErrMsg(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(nowTS)), errorMsg) + errorMsg = fmt.Sprintf("[ddl:-1]Detected TiDB upgrade during [%s, now), can't do flashback", oracle.GetTimeFromTS(nowTS).Format(types.TimeFSPFormat)) + tk.MustGetErrMsg(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(nowTS).Format(types.TimeFSPFormat)), errorMsg) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS")) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/mockFlashbackTest")) diff --git a/pkg/executor/stale_txn_test.go b/pkg/executor/stale_txn_test.go index 8a880e31febb6..5d33241e57514 100644 --- a/pkg/executor/stale_txn_test.go +++ b/pkg/executor/stale_txn_test.go @@ -539,7 +539,7 @@ func TestSetTransactionReadOnlyAsOf(t *testing.T) { }{ { sql: `SET TRANSACTION READ ONLY as of timestamp '2021-04-21 00:42:12'`, - expectedTS: 424394603102208000, + expectedTS: oracle.GoTimeToTS(time.Date(2021, 4, 21, 0, 42, 12, 0, time.Local)), injectSafeTS: 0, }, { @@ -580,7 +580,7 @@ func TestSetTransactionReadOnlyAsOf(t *testing.T) { require.Equal(t, "start transaction read only as of is forbidden after set transaction read only as of", err.Error()) tk.MustExec("begin") - require.Equal(t, uint64(424394603102208000), tk.Session().GetSessionVars().TxnReadTS.PeakTxnReadTS()) + require.Equal(t, oracle.GoTimeToTS(time.Date(2021, 4, 21, 0, 42, 12, 0, time.Local)), tk.Session().GetSessionVars().TxnReadTS.PeakTxnReadTS()) tk.MustExec("commit") tk.MustExec(`START TRANSACTION READ ONLY AS OF TIMESTAMP '2020-09-06 00:00:00'`) } diff --git a/pkg/infoschema/test/clustertablestest/BUILD.bazel b/pkg/infoschema/test/clustertablestest/BUILD.bazel index e992561b17378..67574b5afbd2d 100644 --- a/pkg/infoschema/test/clustertablestest/BUILD.bazel +++ b/pkg/infoschema/test/clustertablestest/BUILD.bazel @@ -50,6 +50,7 @@ go_test( "@com_github_pingcap_kvproto//pkg/metapb", "@com_github_pingcap_tipb//go-tipb", "@com_github_stretchr_testify//require", + "@com_github_tikv_client_go_v2//oracle", "@com_github_tikv_client_go_v2//testutils", "@com_github_tikv_pd_client//http", "@org_golang_google_grpc//:grpc", diff --git a/pkg/infoschema/test/clustertablestest/tables_test.go b/pkg/infoschema/test/clustertablestest/tables_test.go index 63d463649dbfa..b32d893ceeedf 100644 --- a/pkg/infoschema/test/clustertablestest/tables_test.go +++ b/pkg/infoschema/test/clustertablestest/tables_test.go @@ -46,6 +46,7 @@ import ( "github.com/pingcap/tidb/pkg/util/gctuner" "github.com/pingcap/tidb/pkg/util/memory" "github.com/stretchr/testify/require" + "github.com/tikv/client-go/v2/oracle" ) func newTestKitWithRoot(t *testing.T, store kv.Storage) *testkit.TestKit { @@ -1214,8 +1215,12 @@ func TestTiDBTrx(t *testing.T) { memDBTracker := memory.NewTracker(memory.LabelForMemDB, -1) memDBTracker.Consume(19) tk.Session().GetSessionVars().MemDBFootprint = memDBTracker + + t1 := time.Date(2021, 5, 7, 4, 56, 48, 1000000, time.UTC) + t2 := time.Date(2021, 5, 20, 13, 16, 35, 778000000, time.UTC) + sm.TxnInfo[0] = &txninfo.TxnInfo{ - StartTS: 424768545227014155, + StartTS: oracle.GoTimeToTS(t1), CurrentSQLDigest: digest.String(), State: txninfo.TxnIdle, EntriesCount: 1, @@ -1226,7 +1231,7 @@ func TestTiDBTrx(t *testing.T) { blockTime2 := time.Date(2021, 05, 20, 13, 18, 30, 123456000, time.Local) sm.TxnInfo[1] = &txninfo.TxnInfo{ - StartTS: 425070846483628033, + StartTS: oracle.GoTimeToTS(t2), CurrentSQLDigest: "", AllSQLDigests: []string{"sql1", "sql2", digest.String()}, State: txninfo.TxnLockAcquiring, @@ -1252,8 +1257,11 @@ func TestTiDBTrx(t *testing.T) { ALL_SQL_DIGESTS, RELATED_TABLE_IDS from information_schema.TIDB_TRX`).Check(testkit.Rows( - "424768545227014155 2021-05-07 12:56:48.001000 "+digest.String()+" update `test_tidb_trx` set `i` = `i` + ? Idle 1 19 2 root test [] ", - "425070846483628033 2021-05-20 21:16:35.778000 LockWaiting 2021-05-20 13:18:30.123456 0 19 10 user1 db1 [\"sql1\",\"sql2\",\""+digest.String()+"\"] ")) + "424768545227014144 "+t1.Local().Format(types.TimeFSPFormat)+" "+digest.String()+" update `test_tidb_trx` set `i` = `i` + ? Idle 1 19 2 root test [] ", + "425070846483628032 "+t2.Local().Format(types.TimeFSPFormat)+" LockWaiting "+ + // `WAITING_START_TIME` will not be affected by time_zone, it is in memory and we assume that the system time zone will not change. + blockTime2.Format(types.TimeFSPFormat)+ + " 0 19 10 user1 db1 [\"sql1\",\"sql2\",\""+digest.String()+"\"] ")) rows := tk.MustQuery(`select WAITING_TIME from information_schema.TIDB_TRX where WAITING_TIME is not null`) require.Len(t, rows.Rows(), 1) diff --git a/tests/realtikvtest/flashbacktest/BUILD.bazel b/tests/realtikvtest/flashbacktest/BUILD.bazel index 1af86e76f1c04..041715f070d3a 100644 --- a/tests/realtikvtest/flashbacktest/BUILD.bazel +++ b/tests/realtikvtest/flashbacktest/BUILD.bazel @@ -18,6 +18,7 @@ go_test( "//pkg/parser/model", "//pkg/testkit", "//pkg/testkit/testsetup", + "//pkg/types", "//tests/realtikvtest", "@com_github_pingcap_failpoint//:failpoint", "@com_github_stretchr_testify//assert", diff --git a/tests/realtikvtest/flashbacktest/flashback_test.go b/tests/realtikvtest/flashbacktest/flashback_test.go index bdf75056074bf..dfe3b4bc92e22 100644 --- a/tests/realtikvtest/flashbacktest/flashback_test.go +++ b/tests/realtikvtest/flashbacktest/flashback_test.go @@ -29,6 +29,7 @@ import ( "github.com/pingcap/tidb/pkg/meta" "github.com/pingcap/tidb/pkg/parser/model" "github.com/pingcap/tidb/pkg/testkit" + "github.com/pingcap/tidb/pkg/types" "github.com/pingcap/tidb/tests/realtikvtest" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" @@ -85,7 +86,7 @@ func TestFlashback(t *testing.T) { fmt.Sprintf("return(%v)", injectSafeTS))) tk.MustExec("insert t values (4), (5), (6)") - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") require.Equal(t, tk.MustQuery("select max(a) from t").Rows()[0][0], "3") @@ -121,7 +122,7 @@ func TestPrepareFlashbackFailed(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/mockPrepareMeetsEpochNotMatch", `return(true)`)) tk.MustExec("insert t values (4), (5), (6)") - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") require.Equal(t, tk.MustQuery("select max(a) from t").Rows()[0][0], "3") @@ -169,7 +170,7 @@ func TestFlashbackAddDropIndex(t *testing.T) { fmt.Sprintf("return(%v)", injectSafeTS))) tk.MustExec("insert t values (4), (5), (6)") - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") require.Equal(t, tk.MustQuery("select max(a) from t use index(i)").Rows()[0][0], "3") @@ -214,7 +215,7 @@ func TestFlashbackAddDropModifyColumn(t *testing.T) { fmt.Sprintf("return(%v)", injectSafeTS))) tk.MustExec("insert t values (4, 4), (5, 5), (6, 6)") - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") require.Equal(t, tk.MustQuery("show create table t").Rows()[0][1], "CREATE TABLE `t` (\n"+ @@ -265,7 +266,7 @@ func TestFlashbackBasicRenameDropCreateTable(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") require.Equal(t, tk.MustQuery("select max(a) from t").Rows()[0][0], "3") @@ -303,7 +304,7 @@ func TestFlashbackCreateDropTableWithData(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") require.Equal(t, tk.MustQuery("select count(a) from t").Rows()[0][0], "0") @@ -342,7 +343,7 @@ func TestFlashbackCreateDropSchema(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table test.t") res := tk.MustQuery("select max(a) from test.t").Rows() @@ -381,7 +382,7 @@ func TestFlashbackAutoID(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") res = tk.MustQuery("select max(a) from t").Rows() @@ -421,7 +422,7 @@ func TestFlashbackSequence(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) // flashback schema and skip cached values res = tk.MustQuery("select nextval(seq)").Rows() @@ -465,7 +466,7 @@ func TestFlashbackPartitionTable(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustExec("admin check table t") res = tk.MustQuery("select max(a), min(a), count(*) from t").Rows() @@ -506,7 +507,7 @@ func TestFlashbackTmpTable(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) res := tk.MustQuery("select max(a) from t").Rows() require.Equal(t, res[0][0], "3") @@ -522,7 +523,7 @@ func TestFlashbackTmpTable(t *testing.T) { require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS", fmt.Sprintf("return(%v)", injectSafeTS))) - tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.MustExec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) tk.MustGetErrCode("select * from t", errno.ErrNoSuchTable) @@ -572,7 +573,7 @@ func TestFlashbackInProcessErrorMsg(t *testing.T) { } } dom.DDL().SetHook(hook) - tk.Exec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts))) + tk.Exec(fmt.Sprintf("flashback cluster to timestamp '%s'", oracle.GetTimeFromTS(ts).Format(types.TimeFSPFormat))) dom.DDL().SetHook(originHook) require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/ddl/injectSafeTS"))