Skip to content

sqs: preserve FIFO delay order across shard recovery - #1367

Merged
bootjp merged 1 commit into
mainfrom
feature/sqs-fifo-retroactive-delay
Oct 30, 2026
Merged

bootjp merged 1 commit into
mainfrom
feature/sqs-fifo-retroactive-delay

Conversation

@bootjp

@bootjp bootjp commented Oct 30, 2026 •

Copy link
Copy Markdown
Owner

Fixes #1365.

Design: docs/design/2026_10_30_proposed_sqs_fifo_retroactive_delay.md

Changes

  • Apply FIFO queue DelaySeconds changes retroactively to never-received
    messages. Standard queues and existing inflight visibility/receipts retain
    their previous behavior.
  • Persist a per-partition reindex cursor and metadata fence, with each bounded
    page atomically committing its data/visibility/group-index changes and cursor.
    Configuration requests drain the job; cancellation leaves recoverable state
    that the existing leader reaper can continue after restart.
  • Select FIFO heads by a bounded group/sequence index. Earlier undeleted heads
    cannot be overtaken after a delay change, and blocked groups do not prevent
    other groups from progressing. Normal receives do not scan or repair the
    entire backlog.
  • Backfill old queue records without assuming a preexisting index. Fence stale
    sends, batch entries, receives and both redrive sides; retain delete/expiry/
    generation cleanup and metadata/data OCC. Unknown outcomes are not retried
    into successful empty receives or skipped cursor progress.
  • Require complete actual Raft membership, supporting SQS capabilities and
    HT-FIFO routing coverage before activation. The single-group coordinator now
    implements the existing membership capability with value-copy semantics.
  • Fix resolver-owned transaction-record reads and expired-primary abort owner
    selection, plus all SQS partition point reads. A native lost-primary-reply
    test exposed global-group lookup of a durable partition COMMIT; after fixing
    that, a receipt-delete no-op200 exposed the same gap for raw message reads.
    Unknown owners are not record absence; explicit/staged route guards remain.

Risk And Rollout

Changing delay temporarily returns retryable ServiceUnavailable for sends and
receives on that queue until its bounded reconstruction finishes. Work is
proportional to backlog only during configuration/recovery. Pages account about
1 MiB plus transaction framing, permitting one finite accepted-record overshoot
so a valid maximum-size record cannot permanently block recovery.

Activation requires membership quiescence, supporting binaries on every member
and continued use of supporting binaries for new admissions. Downgrade after
activation is unsupported; health polling is not a replicated version-admission
protocol. Historical receipts already returned before the fence are not undone.

Verification

  • The original native legacy/HT diagnostic reproduced B-before-A three times
    before correction. The maintained regression requires positive A delivery,
    rewritten persisted deadlines, real sequence precedence, and controls.
  • Full SQS/FIFO selection: PASS27.192s. Combined adapter native/recovery/concurrency
    race selection: three repetitions PASS21.402s; parent repetition PASS21.578s.
  • Native one/three-node API checks, literal pre-index records, real and encrypted
    Pebble close/reopen, generation reset, redrive fences, byte budgets, missing/
    malformed capability/membership/routing, and existing selected-head controls.
  • Membership race selection: three repetitions pass. Full repository lint: zero
    issues. Jepsen units:331 tests/1206 assertions, zero failures/errors, pinned
    Redis submodule54ab5c10ace229fc780e43e188ef1b64c3a32ee4.
  • Added actual barrier-held stale-page versus purge/delete-recreate/receipt-delete
    checks in both layouts: six cases race20 PASS2.551s. An isolated page-IsTxn=false
    mutation makes all six fail (0.731s); worktree production source was untouched.
    A read-set-only mutation survives because membership tombstone writes also
    provide OCC protection; that control is not claimed as a detected regression.
  • Actual two-Raft-group/Pebble primary-reply-loss/reopen control:16/18 records
    committed, secondary still prepared; persisted decision resolves the cursor,
    remaining backlog completes, A before B and real receipt deletion succeed. Both
    native cases race3 PASS14.056s after genuine reds4.431s/3.069s. Metadata owner
    family/error/expiry controls race3 PASS1.669s; existing migration/RawGet
    controls also pass independent review. Final expanded tests are rerun below.
  • Unfiltered local Go suite was NOT a pass: adapter exhausted its default10m
    package budget; other packages passed. No test
    timeout, iteration count, assertion or capacity was changed to get a pass.
  • The separate pinned Redis submodule unit suite retains an absent namespace
    and upstream failing scaffold; it was not edited or called a success.

Final-push normal/security review and all CI remain required. These local clean
reopens and regression checks do not prove arbitrary crashes or VM nemesis runs.

Final expanded local source: whole KV race without skips PASS72.615s; complete
SQS/FIFO race PASS30.806s; full lint0. Independent re-review reports no validated
blocker under the documented startup conditions, with focused migration and
RawGet controls passing. A composed follower-hop/staged-migration campaign and
ambiguous native abort recovery remain unclaimed. Missing serving groups are
not a supported dynamic-removal configuration; primary metadata reads fail
closed on unavailable owners rather than confirming absence.
Exact staged-only export also passes whole SQS/FIFO race26.865s, selected new KV
owner/membership race1.820s and full repository lint0, without unpublished files.

Author: bootjp

Final Head Gates

HEAD 92069fd passed explicit final-push normal
and security review, full Go race plus unchanged full-length gRPC sequences,
both encrypted/unencrypted Jepsen modes, lint, build, CodeQL and DCO. FIFO
Jepsen confirms 13 committed/received/raw observations with encryption off,
10 with encryption on; ordering is checked, with no lost/duplicate/order or
observation errors. These are nonempty bounded CI workloads, not arbitrary
crash/nemesis acceptance for every new recovery schedule.

The first Go attempt failed an unchanged DynamoDB real-leader-transfer test
with a forwarded DeadlineExceeded instead of its required conflict. The exact
test passed ten race repetitions on this HEAD and ten on clean main. One
documented rerun passed the full workflow without modifying timeouts, iteration
counts, assertions, capacities or production code. The original failure and
its unproven scheduling/timeout root cause remain recorded in the discussion;
this pass does not close the separate seal/concurrency audit.

Signed-off-by: bootjp <contact@bootjp.me>
@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Caution

Review failed

The pull request is closed.

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
  • 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

Comment @coderabbitai help to get the list of available commands.

@bootjp

bootjp commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

@codex review

Please review the latest HEAD 92069fd. Please also run a security review against this exact HEAD, including membership/capability activation checks, cross-group transaction decisions, stale reconstruction fencing and receipt mutation routing.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T01:37:02.532745Z 92069fd Draft marked ready
🔒 Security Review ✅ Completed 2026-10-30T01:38:06.823075Z 92069fd 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

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Already looking forward to the next diff.

Reviewed commit: 92069fdb14

ℹ️ 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".

@chatgpt-codex-connector

Copy link
Copy Markdown

🛡️ Codex Security Review · Automatically triggered

Security review completed. No security issues were found in this pull request.

Reviewed commit: 92069fdb14

View security finding report

Only the user who started this review can view the report in Codex.

ℹ️ About Codex security reviews in GitHub

This is an experimental Codex feature. Security reviews are triggered when:

  • You comment "@codex security review"
  • A regular code review gets triggered (for example, "@codex review" or when a PR is opened), and you’re opted in so security review runs alongside code review

Once complete, Codex will leave suggestions, or a comment if no findings are found.

@bootjp

bootjp commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

CI triage for HEAD 92069fd: Go run 40983804293 failed only TestDynamoDBSnapshotSealRealRaftLeaderChangeFollowerIngress/fresh-commit-stale-read-seal, expecting a definitive forwarded write conflict but receiving DeadlineExceeded. The test, fixture, Internal forwarding, coordinator and leader-proxy files are byte-unchanged from main fc33fa4. The exact real-Raft test passed ten race-detector repetitions on this HEAD (36.868s) and ten repetitions in a clean main export (34.755s). This does not establish the scheduling/timeout root cause; the native seal/concurrency audit remains open. No timeout, iteration, assertion, capacity or production code was weakened. I am rerunning the failed Go workflow once after this comparison, retaining the original failure as evidence. Encrypted and unencrypted Jepsen jobs both passed; final success is not claimed while Go CI is red.

@bootjp
bootjp marked this pull request as ready for review October 30, 2026 01:35
@bootjp

bootjp commented Oct 30, 2026

Copy link
Copy Markdown
Owner Author

Final acceptance for HEAD 92069fd: explicit final-push normal/security reviews passed; both additional reviews triggered by Draft-to-ready also completed without findings (01:37:02Z / 01:38:06Z). All CI checks are successful, including full Go race plus unchanged full-length gRPC sequences and both nonempty FIFO Jepsen modes. No new root inline findings, mergeable/CLEAN, base fc33fa4 unchanged. Merging this component only under the documented supported-binary/membership-quiescence rollout contract; the separate catalog/A0/async and seal concurrency gates remain open.

@bootjp
bootjp merged commit 0b06781 into main Oct 30, 2026
13 of 14 checks passed
@bootjp
bootjp deleted the feature/sqs-fifo-retroactive-delay branch October 30, 2026 01:38
bootjp added a commit that referenced this pull request Nov 11, 2026
## Summary
- Promote the FIFO retroactive delay design to Implemented after #1367
merged its central subsystem.
- Replace stale branch/merge-gate wording and update the document path.

## Risk
Documentation-only; operational crash and deployment acceptance are
still explicitly not claimed.

## Verification
- Confirmed #1367 is merged and the implementation exists in
adapter/sqs_fifo_delay.go and related files.
- git diff --cached --check

Author: bootjp

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

<!-- coderabbit-ai-generated:v1 -->

## Summary by CodeRabbit

* **ドキュメント**
  * 設計記録の状態を実装済みに更新し、マージ済みであることを反映しました。
  * 検証済みの範囲と、未完了のクラッシュ試験・運用ゲートを区別して記載しています。
  * 最終検証の説明と変更パス一覧を、マージ済みの実装に合わせて更新しました。

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

adapter: preserve FIFO head ordering across queue delay changes

1 participant