Repository navigation
fix(relay): tunnel limit counts abandoned reprovisions and frees failed revokes #26320
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
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
d56a0cf
fix(relay): tunnel limit counts abandoned reprovisions and frees fail…
juliusmarminge 93dd2a2
fix(relay): backfill pre-deploy failed deprovisions so they stop hold…
juliusmarminge 453e978
Merge origin/main into t3/relay-quota-edge-states
juliusmarminge 3e10e2e
test(relay): the backfill test allows later migrations
juliusmarminge e8ab0a7
fix(relay): a deleted tunnel whose allocation removal failed stops co…
juliusmarminge 445bc37
fix(relay): the deleted-tunnel mark also runs on interruption and log…
juliusmarminge 4cba6d8
test(relay): deleted-tunnel mark test asserts the claim without optio…
juliusmarminge File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
12 changes: 12 additions & 0 deletions
12
...ay/migrations/postgres/20261028062605_backfill_withdrawn_tunnel_allocations/migration.sql
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| -- Teardown claims used to bump updated_at past the link's revoke or publish-only write, so a | ||
| -- failed deprovision now reads as an unfinished relink. Give those rows the updated_at the | ||
| -- current write rule would have left. Touches only withdrawn links' live tunnels; idempotent. | ||
| UPDATE "relay_managed_endpoint_allocations" AS a | ||
| SET "updated_at" = l."updated_at" | ||
| FROM "relay_environment_links" AS l | ||
| WHERE l."user_id" = a."user_id" | ||
| AND l."environment_id" = a."environment_id" | ||
| AND a."tunnel_id" IS NOT NULL | ||
| AND a."tunnel_released_at" IS NULL | ||
| AND (l."revoked_at" IS NOT NULL OR l."managed_tunnels_enabled" = false) | ||
| AND l."updated_at" < a."updated_at"; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Preserve pre-deploy reprovisions during the backfill.
If a pre-deploy reprovision records a tunnel after withdrawal but stops before rewriting the link, this update replaces its newer allocation timestamp with the link timestamp.
countedAllocationsthen excludes the held tunnel, so later reservations can exceed the tunnel limit. The same timestamp ordering also describes a failed teardown; the currentWHEREclause cannot distinguish them. Use additional provenance to select failed teardowns, or leave ambiguous rows counted. Add a pre-migration reprovision case to the existing migration-backed test. (raw.githubusercontent.com)