catalog/lease: deflake TestLeaseManagerLockedTimestampCluster#166190
Conversation
|
😎 Merged successfully - details. |
rafiss
left a comment
There was a problem hiding this comment.
nice fix!
@rafiss made 6 comments.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on fqazi).
-- commits line 2 at r1:
nit: ctalog
-- commits line 5 at r1:
nit: accquired -> acquired
pkg/sql/catalog/lease/lease_internal_test.go line 1976 at r1 (raw file):
require.NotNil(t, newest) lastVersion := newest.GetVersion() t.Helper()
nit: t.Helper should be the first line of the function. though in this case, i don't think we should use t.Helper at all; it will hide which line failed.
pkg/sql/catalog/lease/lease_internal_test.go line 1982 at r1 (raw file):
<-newVersionCh newest, _ = lm.findNewest(descpb.ID(id)) // Ensure that the new version is accuired. To avoid any race
nit: accuired -> acquired
pkg/sql/catalog/lease/lease_internal_test.go line 1991 at r1 (raw file):
releaseNextVersion = true } // Initial state we only expect a single version.
nit: use a sentence; "In the initial state we only expect a single version."
The test was flaking because it used TestingDescriptorUpdateEvent, which fires before a new version of a descriptor is acquired. To address this, we switch to TestingDescriptorRefreshedEvent, which fires when a new version of a descriptor is acquired. This helps the test become less flakey, because we guarantee that new versions are fully acquired before getting blocked on a channel. Additionally, one of the assertDescriptorCount was in a place where a older timestamp could be acquired, so the assertion itself was race condition prone. Fixes: cockroachdb#166081 Release note: None
4aaedbd to
26c37ed
Compare
fqazi
left a comment
There was a problem hiding this comment.
@fqazi resolved 5 discussions.
Reviewable status:complete! 0 of 0 LGTMs obtained (waiting on rafiss).
|
@rafiss TFTR /trunk merge |
|
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 #166081: branch-release-26.2. Issue #165857: branch-release-26.1, branch-release-26.2. 🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf. |
The test was flaking because it used TestingDescriptorUpdateEvent, which fires before a new version of a descriptor is accquired. To address this, we switch to TestingDescriptorRefreshedEvent, which fires when a new version of a descriptor is acquired. This helps the test become less flakey, because we guarantee that new versions are fully acquired before getting blocked on a channel. Additionally, one of the assertDescriptorCount was in a place where a older timestamp could be acquired, so the assertion itself was race condition prone.
Fixes #165857
Fixes: #166081
Release note: None