Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sql: TestReacquireLeaseOnRestart fix #137628

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Dedej-Bergin
Copy link
Contributor

@Dedej-Bergin Dedej-Bergin commented Dec 17, 2024

Previously we had an extra condition in an if statement which caused this failure. This was the condition errors.Is(err, errRenewLease) it is now removed and we now set toRelease to nil when session != nil

Fixes: #129421
Fixes: #130491

Release note: none

Copy link

blathers-crl bot commented Dec 17, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@Dedej-Bergin Dedej-Bergin requested a review from fqazi December 17, 2024 19:01
@cockroach-teamcity
Copy link
Member

This change is Reviewable

@@ -172,6 +172,7 @@ func (t *descriptorState) upsertLeaseLocked(
}
if session != nil {
s.mu.lease.sessionID = session.ID().UnsafeBytes()
toRelease = nil
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a comment stating why toRelease is being cleared here.

// When using session based leasing, if we end up acquiring the same lease again nothing needs to be cleaned up or updated. This is because the system.lease table does not store any expiry inside the table.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Faizan! I added the comment.

@@ -821,7 +821,7 @@ func purgeOldVersions(
// if we hit this case. Note: This scenario is impossible to hit in the real
// world since the lease duration is never set to 0.
desc, _, err := t.findForTimestamp(ctx, m.storage.clock.Now())
if isInactive := catalog.HasInactiveDescriptorError(err); err == nil || isInactive || errors.Is(err, errRenewLease) {
if isInactive := catalog.HasInactiveDescriptorError(err); err == nil || isInactive {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you try reverting this part of the change and check if the test is stable? I think it's causing CI failures

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the comment above to remove the reference to this error. We no longer have the migration scenario any more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Faizan! I removed the comment.

@Dedej-Bergin Dedej-Bergin marked this pull request as ready for review December 19, 2024 19:54
@Dedej-Bergin Dedej-Bergin requested a review from a team as a code owner December 19, 2024 19:54
Copy link
Collaborator

@fqazi fqazi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! 1 of 0 LGTMs obtained (waiting on @Dedej-Bergin)

@@ -821,7 +821,7 @@ func purgeOldVersions(
// if we hit this case. Note: This scenario is impossible to hit in the real
// world since the lease duration is never set to 0.
desc, _, err := t.findForTimestamp(ctx, m.storage.clock.Now())
if isInactive := catalog.HasInactiveDescriptorError(err); err == nil || isInactive || errors.Is(err, errRenewLease) {
if isInactive := catalog.HasInactiveDescriptorError(err); err == nil || isInactive {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update the comment above to remove the reference to this error. We no longer have the migration scenario any more.

Copy link
Contributor Author

@Dedej-Bergin Dedej-Bergin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale) (waiting on @fqazi)

@@ -172,6 +172,7 @@ func (t *descriptorState) upsertLeaseLocked(
}
if session != nil {
s.mu.lease.sessionID = session.ID().UnsafeBytes()
toRelease = nil
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Faizan! I added the comment.

@@ -821,7 +821,7 @@ func purgeOldVersions(
// if we hit this case. Note: This scenario is impossible to hit in the real
// world since the lease duration is never set to 0.
desc, _, err := t.findForTimestamp(ctx, m.storage.clock.Now())
if isInactive := catalog.HasInactiveDescriptorError(err); err == nil || isInactive || errors.Is(err, errRenewLease) {
if isInactive := catalog.HasInactiveDescriptorError(err); err == nil || isInactive {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Faizan! I removed the comment.

@rafiss rafiss added backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3 backport-24.1.x Flags PRs that need to be backported to 24.1. labels Dec 19, 2024
Previously we had an extra condition in an if statement which caused
this failure.  This was the condition `errors.Is(err, errRenewLease)`
it is now removed and we now set toRelease to nil when `session != nil`

Fixes: cockroachdb#129421

Release note: none
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport-24.1.x Flags PRs that need to be backported to 24.1. backport-24.2.x Flags PRs that need to be backported to 24.2 backport-24.3.x Flags PRs that need to be backported to 24.3
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ccl/backupccl: TestRestoreAsOfSystemTimeGCBounds failed sql: TestReacquireLeaseOnRestart failed
4 participants