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

fix: Allow a process to acquire a lease its already acquired #2735

Merged
merged 2 commits into from
Mar 5, 2024

Conversation

scsmithr
Copy link
Member

@scsmithr scsmithr commented Mar 5, 2024

Related: https://github.com/GlareDB/cloud/issues/2746

Previously we weren't allowing it just errored with something along the lines of:

Catalog error: Lease for database 'a9edc39a-6129-4b19-b8dc-02483df4fc6e' held by other process; other_process_id: d7796f4c-c3e4-4822-b59e-1b4b9f32a48d, current_process_id: d7796f4c-c3e4-4822-b59e-1b4b9f32a48d

I believe I originally intended to allow a leaser to acquire a lease its already acquired based on the error message.

This doesn't fix the rate limit issue, but does partially alleviate errors causes by failing to drop leases because dropping the lease failed due to a rate limit.

scsmithr added 2 commits March 5, 2024 09:14
Related: GlareDB/cloud#2746

Previously we weren't allowing it just errored with something along the lines
of:

```
Catalog error: Lease for database 'a9edc39a-6129-4b19-b8dc-02483df4fc6e' held by other process; other_process_id: d7796f4c-c3e4-4822-b59e-1b4b9f32a48d, current_process_id: d7796f4c-c3e4-4822-b59e-1b4b9f32a48d
```

I believe I originally intended to allow a leaser to acquire a lease its already
acquired based on the error message.

This doesn't fix the rate limit issue, but does partially alleviate errors
causes by failing to drop leases because dropping the lease failed due to a rate
limit.
@@ -242,7 +242,7 @@ impl LeaseRenewer {
})?;

// Some other process has the lease.
if expires_at > now {
if expires_at > now && held_by != self.process_id {
Copy link
Contributor

Choose a reason for hiding this comment

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

i presume that self.process_id is a UUID generated on process start?

Copy link
Member Author

Choose a reason for hiding this comment

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

@greyscaled greyscaled merged commit 81f95db into main Mar 5, 2024
25 checks passed
@greyscaled greyscaled deleted the sean/acquire-lease branch March 5, 2024 16:32
tychoish pushed a commit that referenced this pull request Mar 6, 2024
Related: https://github.com/GlareDB/cloud/issues/2746

Previously we weren't allowing it just errored with something along the
lines of:

```
Catalog error: Lease for database 'a9edc39a-6129-4b19-b8dc-02483df4fc6e' held by other process; other_process_id: d7796f4c-c3e4-4822-b59e-1b4b9f32a48d, current_process_id: d7796f4c-c3e4-4822-b59e-1b4b9f32a48d
```

I believe I originally intended to allow a leaser to acquire a lease its
already acquired based on the error message.

This doesn't fix the rate limit issue, but does partially alleviate
errors causes by failing to drop leases because dropping the lease
failed due to a rate limit.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants