Skip to content

Commit c46724d

Browse files
craig[bot]rafiss
andcommitted
153898: sql: avoid offsetting merge timestamp to reduce unnecessary waiting r=rafiss a=rafiss In 1497315 we added an offset to the merge timestamp to attempt to diagnose an issue we were seeing with backfills. That issue ended up being caused by cockroachdb#144650. The offset makes schema changes wait longer before completing, so since it turned out not to be necessary, this commit reverts to the old behavior. Epic: None Informs: cockroachdb#142917 Release note: None Co-authored-by: Rafi Shamim <[email protected]>
2 parents 30c0ad2 + 079c5dc commit c46724d

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

pkg/sql/backfill.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3019,12 +3019,11 @@ func indexTruncateInTxn(
30193019
// the next resume, a mergeTimestamp newer than the GC time will be picked and
30203020
// the job can continue.
30213021
func getMergeTimestamp(ctx context.Context, clock *hlc.Clock) hlc.Timestamp {
3022-
// Use the current timestamp plus the maximum allowed offset to account for
3023-
// potential clock skew across nodes. The chosen timestamp must be greater
3024-
// than all commit timestamps used so far. This may result in seeing rows
3025-
// that are already present in the index being merged, but that’s fine as
3026-
// they will be treated as no-ops.
3027-
ts := clock.Now().AddDuration(clock.MaxOffset())
3022+
// Use the current timestamp since by this point we only have one descriptor
3023+
// version and no one can commit with the old version due to transaction
3024+
// deadlines from the lease manager. Anything after that version will write to
3025+
// both the backfilled and temporary index.
3026+
ts := clock.Now()
30283027
log.Dev.Infof(ctx, "merging all keys in temporary index before time %v", ts)
30293028
return ts
30303029
}

0 commit comments

Comments
 (0)