Skip to content

Fan out LWT replica RPCs concurrently#119

Open
mweiden wants to merge 1 commit into
mainfrom
claude/audit-fix-12-concurrent-lwt-rpcs
Open

Fan out LWT replica RPCs concurrently#119
mweiden wants to merge 1 commit into
mainfrom
claude/audit-fix-12-concurrent-lwt-rpcs

Conversation

@mweiden

@mweiden mweiden commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Problem

The prepare, read, propose, and commit phases of Cluster::execute_lwt each awaited replicas one at a time inside a for loop, so every Paxos round cost the sum of all replica round-trip times — four times over per transaction. One slow or distant replica stalled every lightweight transaction on the coordinator.

Fix

Each phase now issues its RPCs to all replicas concurrently via futures::future::join_all and merges the results afterwards, bounding per-phase latency by the slowest replica instead of the sum. Quorum accounting, ballot comparison, and the LWW read-merge rules are byte-for-byte unchanged — only the await structure moved.

Tests

  • New concurrent_lwt_inserts_apply_exactly_once: 8 competing IF NOT EXISTS inserts for the same key fired in parallel; exactly one may win.
  • Existing LWT coverage (lwt_test, cluster_lwt_test, lwt_orders_test, replication_grpc_test — including multi-node gRPC paths and the insufficient-replica error case) all pass unchanged.

Found by codebase audit (medium severity: per-replica latency summing on the LWT hot path).

https://claude.ai/code/session_01CJXWjB9ERGgV6B9mRqrdM9


Generated by Claude Code

The prepare, read, propose, and commit phases of execute_lwt each
awaited replicas one at a time inside a loop, so every Paxos round cost
the sum of all replica round-trip times. With a slow or distant
replica, every lightweight transaction stalled behind it four times
over.

Each phase now issues its RPCs to all replicas concurrently via
join_all and merges results afterwards, bounding per-phase latency by
the slowest replica instead of the sum. Quorum accounting, ballot
comparison, and the LWW read-merge rules are unchanged.

https://claude.ai/code/session_01CJXWjB9ERGgV6B9mRqrdM9
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