Skip to content

Custom queue-storage schema: reject runtime slot counts that differ from the installed ring #689

Open

Description

@hardbyte

A runtime on a custom queue-storage schema can be configured with different ring slot counts from the ones the schema was installed with, and nothing rejects it.

How it happens. install_queue_storage_substrate seeds {queue,lease,claim}_ring_state.slot_count with ON CONFLICT (singleton) DO NOTHING, so preparing an existing schema with different counts keeps the installed counts without error. Rotation then follows the installed slot_count, while several runtime paths bound slots by the configured count:

  • complete_receipt_runtime_batch_fast maps the claim slot through ring_slot_index(.., claim_slot_count(), ..), so a claim in a slot at or above the configured count fails completion with invalid claim ring slot N.
  • Both receipt-rescue loops iterate 0..claim_slot_count(), so claims in higher slots are never rescued.
  • oldest_initialized_claim_slot_tx filters slots to < claim_slot_count().

With fewer configured than installed slots, jobs claimed into the higher slots can fail to complete or stay stranded after a worker dies. The default awa schema is not affected: both the installer and QueueStorage::new force default slot counts there.

Proposed fix. At startup (or in prepare_schema), read the three *_ring_state.slot_count values and refuse to run when the configured counts differ, naming both values. Admin reads already use installed slot numbers (#665, #688).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions