Skip to content

Commit 079c5dc

Browse files
committed
sql: avoid offsetting merge timestamp to reduce unnecessary waiting
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 #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. Release note: None
1 parent 3c9f2ee commit 079c5dc

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
@@ -2994,12 +2994,11 @@ func indexTruncateInTxn(
29942994
// the next resume, a mergeTimestamp newer than the GC time will be picked and
29952995
// the job can continue.
29962996
func getMergeTimestamp(ctx context.Context, clock *hlc.Clock) hlc.Timestamp {
2997-
// Use the current timestamp plus the maximum allowed offset to account for
2998-
// potential clock skew across nodes. The chosen timestamp must be greater
2999-
// than all commit timestamps used so far. This may result in seeing rows
3000-
// that are already present in the index being merged, but that’s fine as
3001-
// they will be treated as no-ops.
3002-
ts := clock.Now().AddDuration(clock.MaxOffset())
2997+
// Use the current timestamp since by this point we only have one descriptor
2998+
// version and no one can commit with the old version due to transaction
2999+
// deadlines from the lease manager. Anything after that version will write to
3000+
// both the backfilled and temporary index.
3001+
ts := clock.Now()
30033002
log.Dev.Infof(ctx, "merging all keys in temporary index before time %v", ts)
30043003
return ts
30053004
}

0 commit comments

Comments
 (0)