Repository navigation
test(persona-soak): shard operator persona (live enqueue_shards changes under restricted roles) - #639
Merged
Merged
Conversation
Mia, Tom, Priya, Sam, Alex and a chaos agent run concurrently against one disposable database on the queue-storage engine. An oracle checks duplicate terminal rows, terminal-and-live overlap, unexplained cancels, stalls, promotion lag, lost jobs, cron double-fires and server crashes, and a failed run writes a reproducer. scripts/persona-soak.sh runs the engine matrix in private containers.
… handlers, document the new personas
…h recovery from the statistics reset
…, exit the Python process with its parent
…te, resume paused queues reliably, treat unfinished backlog as a finding
Parent jobs batch-insert unique child jobs into their own queue from concurrent handlers, and some replay a batch with an already-claimed unique key to exercise the unique-violation fallback to row-by-row inserts.
Changes enqueue_shards on two hot queues under live load while producers, promotion and claimers run as non-superuser roles: a schema owner, a migrator role with default privileges, and two application roles in a runtime group role. Covers prepare_queue before and without a raise, runtimes and producer handles that disagree about the cached shard count, and new lanes first created by the maintenance leader's role. The oracle gains per-shard claim cursor and drain checks, ordering_key FIFO within a settled window, execution counts across shard changes, and a scan of the server log for permission-denied and missing-lane errors with the role, lane, sequence owner and statement.
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: true
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. |
This was referenced Nov 7, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Review prerequisite
Merge this branch only with #644, including the corrected shared oracle at
412419f864567c29386d9651cad93b82f6ddd997. This head still uses the earlier oracle. The corrected harness requires durable attempt-specific terminal proof, treats failed final lookups as inconclusive, accounts for materialized claims, and handles Python startup/drain restarts. It correlates migration sessions with probe phases, fences reads crossing process kills, keeps terminal observations tied to the greatest proven lease, and requires successfulCLOSEDproof before reporting a retained-session leak. Ambiguous or missing evidence remains inconclusive; still-live losses and proven conflicts remain failures.Historical results below predate these corrections and need validation with the corrected harness before release acceptance. Those reports have not been recomputed or retrospectively cleared.
Refs #624. This stacks on that PR (and on the fan-out persona commit), so the two commits to review are the shard operator persona and the follow-up that adds lane-race and repeat-execution reporting. It will be rebased once #624 lands. It is a separate PR so the persona can be reviewed on its own.
What this adds
A shard operator persona for the persona soak. An operator changes
awa.queue_meta.enqueue_shardson two hot queues while producers, promotion (scheduled jobs and retries) and claimers run:prepare_queuefirst (as the schema owner or as the migrator role), some do not;QueueStoragehandles are restarted before others, so the cached shard counts disagree across the fleet for a while, and the rest are restarted later (QueueStorage::reset()truncates the store, so a restart is the only way to drop the cache under load);insert_many,insert_many_copyandQueueStorage::enqueue_params_batch, with plain, scheduled, retrying andordering_keyjobs;prepare_queue, the producers are held until the maintenance leader's runtime has created the new lanes, so a different role is the next to use them.Roles
When the persona is selected the soak runs its actors as non-superuser roles, granted as in
docs/security.md:awa_soak_ownerowns the database and schema, runs migrations andprepare_queue, and changesenqueue_shards;awa_soak_migratoris a member of the owner role with default privileges on tables, sequences and functions;awa_soak_app_aandawa_soak_app_bare members ofawa_soak_runtime, with no default privileges of their own. They run the persona's producers and runtimes; the leader is one of the persona's runtimes (the persona ends other personas' leadership and its runtimes retry election every 100 ms).AWA_SOAK_SHARDOPS_SCHEMA_CREATE=0withholds schemaCREATEand makes the operator provision every lane before raising a count (the restricted-runtime procedure). With the default (1) lanes are created on the fly. In a mixed run, default privileges for the superuser keep the other personas' objects usable by the application roles.Oracle additions
ordering_keyjobs start in order per key within a window in which every runtime had observed the shard count (a key legitimately moves shard across a change);scripts/persona-soak.shnow setslog_line_prefixto include%u@%a; each violation names the role, lane, sequence owner and statement.Results
Seed 42,
mia,tom,priya,sam,alex,shardops,AWA_SOAK_SCALE=0.2, 25 minute load, onpostgres:17andpostgres:18.permission_deniedfrom both application roles, claim cursors frozen on the affected queue, shards above the count never drainOn v0.6.13 the first denial is within a second of the new lanes being created: the leader's role owns the new sequences, and the other role's producers fail with
permission denied for sequence queue_enqueue_seq_*. Reads of lane depth and claims fail too, so the whole queue stops claiming, not only the new shard. A raise that runsprepare_queuefirst is clean. WithAWA_SOAK_SHARDOPS_SCHEMA_CREATE=0and the persona alone, 10 minute runs pass on both engines.The same cause as a few statements, with a runtime group role granted as in
docs/security.mdplus schemaCREATE:Also seen
pg_class_relname_nsp_indexunique violation frominsert_many_copyon v0.6.13 (pg17): two sessions creating the same lane sequence at once. The scan now reports it aslane_creation_race. Not seen on fix(queue-storage): create queue lanes as the schema owner (0.6) #638.Test plan
cargo clippy -p awa --test persona_soak_test -- -D warnings,cargo fmt --all --checkAWA_SOAK_SHARDOPS_SCHEMA_CREATE=0, 10 minutes, pg17 and pg18: pass