Skip to content

docs(upgrade): revoke a running 0.6 fleet's schema CREATE without a pause - #541

Merged
hardbyte merged 13 commits into
mainfrom
brian/restricted-runtime-prepare
Nov 13, 2026
Merged

hardbyte merged 13 commits into
mainfrom
brian/restricted-runtime-prepare

Conversation

@hardbyte

@hardbyte hardbyte commented Oct 21, 2026 •

Copy link
Copy Markdown
Owner

The 0.6→0.7 upgrade guide told split-role installs to pause 0.6 producers and workers while revoking the runtime role's schema CREATE. That pause is no longer needed: awa migrate from 0.6.14 or later applies the prepared_lane_sequences and definer_lane_provisioning schema patches to a v40 database, after which no runtime role needs CREATE. The guide and CHANGELOG now say to run those patches first and then revoke under traffic, and point at the 0.6 rehearsal that covers it.

This PR originally added an awa storage prepare-create-revoke command to do that preparation from a 0.7 binary. It is removed: the 0.6 patches already do the job, and the command would have installed main's lane helpers, which call awa.lane_sequence_problems, on 0.6 databases that lack it. The point-read tombstone fix this PR also carried reached main through #629.

What remains besides the docs: the prune tests that a background session can block (the carry-forward, re-carry and reader-lock tests) share one helper that retries only a Blocked outcome for the expected slot, as the maintenance loop would.

Validation: workspace build, fmt, clippy on the awa crate, and the prune tests in queue_storage_runtime_test (37 passed). Full CI covers the rest on PostgreSQL 17 and 18.

The enqueue and claim head triggers fire BEFORE INSERT, ahead of ON CONFLICT, and read the lane's sequence. A lane a 0.6 runtime created has a sequence that runtime owns, so awa storage prepare-queue run as the migrator failed with 42501 on any such lane, and every runtime cache miss re-synced an existing sequence. Head rows are now inserted only when absent, under the lane lock runtimes already take for these inserts.
…a CREATE without a pause

The migration trust check refuses a schema where another role holds CREATE, but 0.6 lane helpers run CREATE SEQUENCE IF NOT EXISTS on every reservation, so revoking the grant before migrating stopped running 0.6 producers and workers with 42501. The documented path was a pause.

awa storage prepare-create-revoke, run as the migrator under a running 0.6 fleet, replaces each queue-storage schema's lane helpers with the ones v049 installs (identical to every 0.6 release's helpers apart from creating a sequence only when it is missing), provisions all four priorities of every shard of every queue in use, and grants the roles holding CREATE the privileges they need on the sequences it creates. It applies the migration's own trust rules apart from the CREATE grant, leaves a schema with any other violation unchanged, checks the rules again before committing, and prints the REVOKE statements plus the sequence grants only the sequences' runtime owners can make, which the migration needs to read and set those sequences. The upgrade guide replaces the pause procedure with these steps.

The new test installs a v040 schema with the 0.6.9 lane helpers and 0.6 grants, shows revoking CREATE first breaks a 0.6 reservation, and then runs the command, grants and revokes under a 2 s lock_timeout while a 0.6 enqueue transaction stays open, before migrating to the current version. Each part of the fix fails the test when reverted.
Runs an awa-pg 0.6.9 producer and worker as the runtime role while CREATE is revoked, with and without prepare-create-revoke, then migrates to the current version and reports failed inserts and slow inserts with lock waits. Against PostgreSQL 17: revoking without preparing fails every enqueue for the rest of the run (471 errors in 10 s); preparing first gives 0 failures and every job completes, with the prepare, grants and revokes taking 0.2 s and no insert slower than 250 ms until migrate, which blocks enqueues for its whole 5.2 s transaction.
@coderabbitai

coderabbitai Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 20 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 70d4b47 and bb9865e.

Files selected for processing: 3

  • CHANGELOG.md
  • awa/tests/queue_storage_runtime_test.rs
  • docs/upgrade-0.6-to-0.7.md
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@github-actions

github-actions Bot commented Oct 21, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-11-13 03:16 UTC

@hardbyte hardbyte added the full-ci Run the full CI matrix (Python build+test, E2E) on this PR label Nov 6, 2026 — with ChatGPT Codex Connector
hardbyte and others added 7 commits November 7, 2026 02:49
Apply the reviewed standalone read correction without changing the
CREATE-revoke preparation protocol. Cover priority and queue moves across
ready-ring wrap with the same two deterministic regressions.
The 0.6 line now ships what prepare-create-revoke did. On a v40 database,
the prepared_lane_sequences schema patch (0.6.10) makes the lane helpers
skip CREATE SEQUENCE when a lane's sequence exists, and the
definer_lane_provisioning patch (0.6.14) creates a missing lane's
sequences through the schema owner's SECURITY DEFINER functions. Running
`awa migrate` with a 0.6.14 or later CLI therefore lets runtime roles lose
schema CREATE while 0.6 binaries keep running, without a 0.7 command.

The merged command would also have installed main's lane helpers, whose
provision_lane_sequences calls awa.lane_sequence_problems, on 0.6
databases that lack it.

The point-read tombstone fix, its two ring-wrap regressions and the
carry-forward prune retry reached main through #629 and e2fbfa6.
The carry-forward test already retries prune while a background session
holds the slot. The re-carry test's two prunes and the reader-lock test's
prune after the lock is released had the same exposure; route all three
through one helper that retries only Blocked for the expected slot.
….6 lane patches

The guide asked for a pause because unpatched 0.6 lane helpers check
schema CREATE on every reservation. awa migrate from 0.6.14 or later
applies prepared_lane_sequences and definer_lane_provisioning to a v40
database, after which no runtime role needs CREATE, so the revoke can
happen under traffic. Point at the 0.6 rehearsal that covers it.
@hardbyte hardbyte changed the title feat(storage): revoke 0.6 runtimes' schema CREATE without a pause docs(upgrade): revoke a running 0.6 fleet's schema CREATE without a pause Nov 13, 2026
@hardbyte
hardbyte marked this pull request as ready for review November 13, 2026 01:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T01:10:55.275090Z 443e679 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 443e6790af

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/upgrade-0.6-to-0.7.md Resolved
@hardbyte
hardbyte merged commit acd8515 into main Nov 13, 2026
53 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

full-ci Run the full CI matrix (Python build+test, E2E) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant