Skip to content

Commit dceb3e8

Browse files
craig[bot]msbutler
andcommitted
Merge #150864
150864: backup: deflake TestScheduleChainingWithDatabaseExpansion r=kev-cao a=msbutler In TestScheduleChainingWithDatabaseExpansion, the test hook manipulates the server time and sets the system time the backups are executed at to the server time. For mysterious reasons (maybe overload/scheduling latency?), this server time can occasionally exceed the backup statement execution time, which causes the backup statement to fail, with a aost timestamp "is in the future" error. Since this test already curves space time, I didn't dig further into the root cause of this behavior and instead ensured the backup aost is never greater than the statement time. Informs #150557 Release note: none Co-authored-by: Michael Butler <[email protected]>
2 parents acd07c1 + 6f56b66 commit dceb3e8

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

pkg/backup/schedule_pts_chaining_test.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,13 @@ INSERT INTO t select x, y from generate_series(1, 100) as g(x), generate_series(
422422
`)
423423

424424
backupAsOfTimes := make([]time.Time, 0)
425-
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, _ time.Time) {
425+
th.cfg.TestingKnobs.(*jobs.TestingKnobs).OverrideAsOfClause = func(clause *tree.AsOfClause, statementTime time.Time) {
426426
backupAsOfTime := th.cfg.DB.KV().Clock().PhysicalTime()
427+
if backupAsOfTime.After(statementTime) {
428+
// If the backupAsOfTime is after the statement time, then we use the
429+
// statement time.
430+
backupAsOfTime = statementTime
431+
}
427432
expr, err := tree.MakeDTimestampTZ(backupAsOfTime, time.Microsecond)
428433
require.NoError(t, err)
429434
clause.Expr = expr

0 commit comments

Comments
 (0)