catalog/lease: handle lease timestamps below GC interval#161878
catalog/lease: handle lease timestamps below GC interval#161878craig[bot] merged 1 commit intocockroachdb:masterfrom
Conversation
1d4482b to
01c7e75
Compare
Potential Bug(s) DetectedThe three-stage Claude Code analysis has identified potential bug(s) in this PR that may warrant investigation. Next Steps: Note: When viewing the workflow output, scroll to the bottom to find the Final Analysis Summary. After you review the findings, please tag the issue as follows:
|
01c7e75 to
3d7ef93
Compare
rafiss
left a comment
There was a problem hiding this comment.
this fix looks good, just had two nits.
@rafiss made 3 comments.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @fqazi).
pkg/sql/catalog/lease/lease.go line 2093 at r1 (raw file):
var err error id, err := m.resolveName(ctx, timestamp.GetTimestamp(), parentID, parentSchemaID, name) if err != nil &&
nit: can you simplify this logic so that everything is inside of one top-level if err != nil { ... }. i think this would improve readability.
pkg/sql/catalog/lease/lease_test.go line 4144 at r1 (raw file):
// TestLeaseBeforeGC validates if a lease timestamp for some reason is before // a GC interval, we correctly fallback to the read timestamp from the txn. func TestLeaseBeforeGC(t *testing.T) {
we should also unskip TestRestoreAsOfSystemTimeGCBounds as part of this PR, since this is closing the linked issue #161220
(verify the test passes under stress first, see repro notes at #161220 (comment))
Previously, when locked leasing timestamps were used, it was possible for the lease time to fall below the GC interval in some synthetic scenarios during name resolution. To address this, this patch updates the name resolution logic in the lease manager to treat GC errors as missing descriptors at a given timestamp. This forces the system to use the read timestamp correctly. Fixes: cockroachdb#161220 Release note: None
3d7ef93 to
580fbc8
Compare
fqazi
left a comment
There was a problem hiding this comment.
@fqazi made 1 comment and resolved 1 discussion.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on @rafiss).
pkg/sql/catalog/lease/lease_test.go line 4144 at r1 (raw file):
Previously, rafiss (Rafi Shamim) wrote…
we should also unskip TestRestoreAsOfSystemTimeGCBounds as part of this PR, since this is closing the linked issue #161220
(verify the test passes under stress first, see repro notes at #161220 (comment))
The test was already unskipped via: #161795.
I did confirm after reverting Andrew's PR (and unskipping the test) the issue no longer reproduces under stress.
rafiss
left a comment
There was a problem hiding this comment.
@rafiss made 1 comment.
Reviewable status:complete! 1 of 0 LGTMs obtained.
|
@rafiss TFTR! bors r+ |
|
Based on the specified backports for this PR, I applied new labels to the following linked issue(s). Please adjust the labels as needed to match the branches actually affected by the issue(s), including adding any known older branches. Issue #161220: branch-release-26.1. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
Previously, when locked leasing timestamps were used, it was possible for the lease time to fall below the GC interval in some synthetic scenarios during name resolution. To address this, this patch updates the name resolution logic in the lease manager to treat GC errors as missing descriptors at a given timestamp. This forces the system to use the read timestamp correctly.
Fixes: #161220
Release note: None