Skip to content

feat(persistence): MqPop v2 payload — PEL delivery/seen timestamps survive kill-9 and promotion (task #47) - #316

Merged
pilotspacex-byte merged 4 commits into
mainfrom
feat/mqpop-v2-pel
Jul 13, 2026
Merged

feat(persistence): MqPop v2 payload — PEL delivery/seen timestamps survive kill-9 and promotion (task #47)#316
pilotspacex-byte merged 4 commits into
mainfrom
feat/mqpop-v2-pel

Conversation

@pilotspacex-byte

Copy link
Copy Markdown
Contributor

Task #47: apply_mq_pop hardcoded claimed PEL entries' delivery/seen times to 0, so XPENDING on a recovered/promoted node reported astronomically large idle times. MqPop now versions independently (MQ_POP_WAL_V2) appending [delivery_time_ms][seen_time_ms]; v1 decodes fail-closed to sentinel resolved as apply-time now (documented; strictly better than hardcoded 0), unknown versions rejected.

New integration tests (real kill-9: xpending_idle_metadata_survives_kill9; real promotion: promoted_replica_reports_real_pending_idle_time) green; mq lib 111 green; fuzz covers the decoder generically; minimal apply.rs diff (decode-only) per cross-branch coordination. fmt+clippy both matrices clean. Refs task #47, PR #291/#301.

…ry_time/seen_time (task #47)

apply_mq_pop (boot-time WAL replay AND live replica apply share this
function) hardcoded a claimed PEL entry's delivery_time/seen_time to 0
regardless of when MQ.POP actually claimed it. Since XPENDING's idle time
is `now - delivery_time`, a kill-9 restart or a promoted replica reported
"idle since the Unix epoch" instead of the real elapsed duration.

Bump MqPop to its own v2 payload (MQ_POP_WAL_V1/V2 in src/mq/wal.rs — MqPop
now versions independently of the shared MQ_WAL_VERSION every other MQ
record uses) appending [delivery_time_ms:u64][seen_time_ms:u64] captured
once per POP batch. mq_exec.rs's POP handler reads these back out of the
PEL/consumer state it just wrote. Decode is version-led and fail-closed:
v1 payloads still decode, filling an explicit 0 sentinel that apply_mq_pop
resolves to current_time_ms() at apply time (a strict improvement over the
old hardcoded-0 behavior). Any other version byte is rejected.

Updated: src/mq/wal.rs (encode/decode + tests), src/shard/mq_exec.rs
(producer), src/shard/shared_databases.rs (apply_mq_pop + boot replay),
src/replication/apply.rs (live replica apply, kept minimal per task #48
overlap warning). New coverage: v1/v2 codec round-trip + truncation tests,
a kill-9 integration test (XPENDING idle survives restart), and a
replica-promotion test (promoted node reports the master's original claim
time, not its own apply time).

author: Tin Dang
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@TinDang97, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 59 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e33d6cef-e66e-4963-8fae-4822217e2671

📥 Commits

Reviewing files that changed from the base of the PR and between af65a29 and fc74d24.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • src/mq/wal.rs
  • src/replication/apply.rs
  • src/shard/mq_exec.rs
  • src/shard/shared_databases.rs
  • tests/crash_recovery_mq_effects.rs
  • tests/replication_mq.rs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/mqpop-v2-pel

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.

@TinDang97 TinDang97 closed this Jul 13, 2026
@TinDang97
TinDang97 deleted the feat/mqpop-v2-pel branch July 13, 2026 10:33
@TinDang97
TinDang97 restored the feat/mqpop-v2-pel branch July 13, 2026 10:34
@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@pilotspacex-byte
pilotspacex-byte merged commit 547b0be into main Jul 13, 2026
1 check was pending
@TinDang97
TinDang97 deleted the feat/mqpop-v2-pel branch July 13, 2026 11:20
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.

2 participants