feat(persistence): MqPop v2 payload — PEL delivery/seen timestamps survive kill-9 and promotion (task #47) - #316
Conversation
…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 reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
Warning Review limit reached
Next review available in: 59 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the 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 configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (7)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
…340cf999ff8 # Conflicts: # CHANGELOG.md
…340cf999ff8 # Conflicts: # CHANGELOG.md
Task #47:
apply_mq_pophardcoded 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.