Repository navigation
Conversation
Deferred and DLQ rows dropped the job's enqueue shard, so every path back to ready (promotion, DLQ retry, manual retry) picked a shard through the rotor: a keyed job's retry left its key's lane, and every job one promotion returned to a (queue, priority) shared a single rotor-chosen shard. Migration v064 adds a nullable enqueue_shard to deferred_jobs and dlq_entries in every queue-storage schema, through a new installer helper. Retry, snooze, rescue, DLQ moves, scheduled keyed enqueues and the other moves keep the shard, and insert_claimed_ready_rows_tx puts the job back on it, modulo the destination queue's enqueue_shards. NULL takes the rotor as before. Binaries probe for the column, so they run before the migration and start retaining shards after it without a restart.
Record the claim-path changes since acceptance and what each means for per-key control, the head-of-line blocking a saturated key causes across keys that share its lane, and a narrower E5 comparing row-local claims, key arrays on indexed compact claim batches, and parking. Key arrays return as a candidate now that v054 indexes compact claim batches. Tier 1 per-key rates build on #718's fleet share. #340 moves to 0.8.
ADR-010's rate limit is per runtime, so a fleet of N runtimes starts up to N times the configured rate, and ADR-038 could only retune a limit the builder configured. ADR-054 adds QueueConfig::fleet_rate_limit: each runtime enforces its share, its worker capacity for the queue over the capacity of the live runtimes serving it, recomputed on the override refresh from runtime snapshots. Each queue's limiter can now hold no bucket, so an override can enable, retune or remove a limit live; a retune never grants a fresh burst. Migration v065 adds fleet rate and burst overrides, a per-runtime burst override, an override revision, and who/why audit columns to queue_meta. Runtimes publish the revision, weight, share and rate they applied, and `awa queue overrides show` reports how many live runtimes applied the current revision. The CLI gains --fleet-rate-limit, --fleet-rate-burst, --rate-burst, --reason and --by.
|
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. |
hardbyte
force-pushed
the
brian/issue-340-key-retention
branch
from
November 30, 2026 22:01
5ad7bcb to
32de11e
Compare
This branch has not been deployed
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.
Part of #718: fleet-wide rate limits that can be set live, covering the runtime, the storage and the CLI. The HTTP API, admin UI and Python bindings follow in a second PR.
Stacked on #884 (migration v064), so this PR's migration is v065. Merge #884 first.
What changes
ADR-054, fleet rate limits.
rate_limitand gainsfleet_rate_limit. Each runtime enforces the lower of the two: its own limit, or its share of the fleet limit.max_workers, ormin_workersplus the overflow pool in weighted mode. The share is recomputed on the ADR-038 override refresh from runtime snapshots, and a share's burst is floored at one token.Live limits. Each queue has one rate control per runtime, shared by its claimers. It can hold no bucket, so an override can now enable a limit on a queue built without one, retune it, or remove it. This removes ADR-038's first guard rail. A retune keeps the bucket's tokens, capped at the new burst, so it never grants a fresh burst.
Migration v065. Adds these columns to
awa.queue_meta:override_fleet_rate_limitandoverride_fleet_rate_burst;override_rate_burst;overrides_revision, which every write advances;overrides_updated_byandoverrides_reason.It only adds columns. Binaries from this release read the ADR-038 columns when the new ones are missing, so they can run before the migration.
Applied state. Each runtime's per-queue snapshot carries
rate_control: its weight, the override revision it applied, its fleet share and the rate it enforces.rate_controlsits outside the config snapshot, so differing shares don't count as aconfig_mismatch.admin::queue_override_applicationreports which live runtimes applied a revision.CLI.
awa queue overrides setgains--fleet-rate-limit,--fleet-rate-burst,--rate-burst,--reasonand--by.showprints the revision, who changed the overrides and why, "applied by N of M live runtimes", and each runtime's share and enforced rate.Docs.
docs/configuration.md: runtime versus fleet limits, the tolerance, and returningSnoozeon an upstream 429.awa-jobsskill.Not in this PR
GET/PUT/DELETE /api/queues/{queue}/overrides), the admin UI and the Python bindings.showlists it as reporting no rate control.Testing
awa/tests/fleet_rate_limit_test.rs:When every share is forced to 1.0, both tests fail: two runtimes start 89 jobs against a ceiling of 71.
Unit tests:
Existing suites pass:
rate_limit_test,queue_overrides_test, awa-uiruntime_api_test, the awa-worker, awa-model and awa-cli unit tests, and frommigration_test,test_every_migration_is_individually_re_runnableandtest_fresh_install_reaches_current_version.