test: stabilize TestGetAndResetRecentInfoSchemaTS (#58589)

close pingcap/tidb#58453
This commit is contained in:
tangenta
2024-12-28 15:15:51 +08:00
committed by GitHub
parent 0097df9034
commit be6396c725
2 changed files with 2 additions and 1 deletions

View File

@ -74,7 +74,7 @@ func NewCache(r autoid.Requirement, capacity int) *InfoCache {
// The keepAlive() function will compare the InfoSchemaV2's ts with Data.recentMinTS, and
// update the Data.recentMinTS to smaller one.
//
// In a nutshell, every round of ReportMinStartTS(), the minimal known TS used be InfoSchemaV2 APIs will be reported.
// In a nutshell, every round of ReportMinStartTS(), the minimal known TS used by InfoSchemaV2 APIs will be reported.
// Some corner cases might happen: the caller take an InfoSchemaV2 instance and not use it immediately.
// Seveval rounds later, that InfoSchema is used and its TS is reported to block GC safepoint advancing.
// But that's too late, the GC has been done, "GC life time is shorter than transaction duration" error still happen.

View File

@ -563,6 +563,7 @@ func TestInfoSchemaCachedAutoIncrement(t *testing.T) {
func TestGetAndResetRecentInfoSchemaTS(t *testing.T) {
store, dom := testkit.CreateMockStoreAndDomain(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec("set @@global.tidb_schema_cache_size = 1024 * 1024 * 1024")
// For mocktikv, safe point is not initialized, we manually insert it for snapshot to use.
timeSafe := time.Now().Add(-48 * 60 * 60 * time.Second).Format("20060102-15:04:05 -0700 MST")