Skip to content

Commit a8b916c

Browse files
authored
Merge pull request #150938 from cockroachdb/blathers/backport-release-25.3-150864
release-25.3: backup: deflake TestScheduleChainingWithDatabaseExpansion
2 parents eac9b43 + 043a235 commit a8b916c

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)