Repository navigation
fix(partitions): don't commit a stale prepare after adopting a newer view - #4433
Conversation
…view (backport of apache#4433) Backports upstream PR apache#4433 (commit 00b57ff) onto our stack. A partition replica that journaled a prepare in an old view and never replicated it could commit that stale prepare after adopting a newer view whose log committed a different prepare at the same op, so replicas served different messages at the same offset. The PR adds a view fence and its simulator regression (stale_prepare_commit_tests). Fixes apache#4284 for our fork until upstream merges apache#4433. (cherry picked from commit 00b57ff) Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Thanks for this fix, @numinnex. Before it lands, we want to report a regression we hit while testing it. Summary. With this PR applied on current master ( Setup
Results: original configuration (6 partitions, ~2,000 msg/s)
In the failing runs every send was acknowledged in the end. Send latency peaked at ~31 s, and a few dozen transient errors were retried. After the run, the GetTopic answer from each of the three nodes is Narrowed repro (1 partition, same kill schedule unless noted)
One FAIL run at 150 msg/s queried GetTopic on every node between steps. These queries shifted the later steps by up to ~45 s. After node 1 was killed, the message count stopped at 7,495 on every node that answered; in the same window of the master control run, the count went from 9,546 to 15,070. The count stayed at 7,495 after node 1 restarted. Within 5 s of killing node 2, the two remaining nodes (both restarted earlier) answered 0. Max send latency in that run was 125.7 s (master: 15.1 s). What the logs showThe narrowed single-kill run (PR, 1 partition, 150 msg/s) shows the stall on its own. After restarting, node 0 fences its whole history and asks a peer for ops 1..247. The peer serves through op 128. Node 0 then asks for 1..247 again, about once per second, for the next ~100 s, until the logs were collected: The original 6-partition failing runs show the same pattern on every partition of the first restarted node, with ~90 re-requests from For comparison, on master a restarted node asks for A correction to something we first suspected: the segment recovery warning below appears on every build after each SIGKILL, master included, so it is not specific to this PR: On Analysis (our reading of the code; please correct us)
What we have not established
Cluster setup used (plain Docker)NET=repro; SUB=172.50.0; docker network create --subnet $SUB.0/24 $NET
for i in 0 1 2; do
roster=()
for n in 0 1 2; do
roster+=(-e IGGY_CLUSTER_NODES_${n}_NAME=node-$n -e IGGY_CLUSTER_NODES_${n}_IP=$SUB.1$n
-e IGGY_CLUSTER_NODES_${n}_REPLICA_ID=$n -e IGGY_CLUSTER_NODES_${n}_PORTS_TCP=8090
-e IGGY_CLUSTER_NODES_${n}_PORTS_QUIC=8080 -e IGGY_CLUSTER_NODES_${n}_PORTS_HTTP=3000
-e IGGY_CLUSTER_NODES_${n}_PORTS_WEBSOCKET=8092 -e IGGY_CLUSTER_NODES_${n}_PORTS_TCP_REPLICA=9090)
done
docker run -d --name node-$i --hostname node-$i --network $NET --ip $SUB.1$i \
--cpus 2 --memory 4g --security-opt seccomp=unconfined -v node-$i:/app/local_data \
-e IGGY_ROOT_USERNAME=iggy -e IGGY_ROOT_PASSWORD=iggy \
-e IGGY_TCP_ADDRESS=$SUB.1$i:8090 -e IGGY_HTTP_ADDRESS=$SUB.1$i:3000 \
-e IGGY_QUIC_ENABLED=false -e IGGY_WEBSOCKET_ENABLED=false \
-e IGGY_SHARDING_CPU_ALLOCATION=2 -e IGGY_SHARDING_PIN_CORES=false -e IGGY_MEMORY_POOL_SIZE=1GiB \
-e IGGY_CLUSTER_ENABLED=true -e IGGY_CLUSTER_NAME=repro \
-e IGGY_CLUSTER_AUTH_ENABLED=true -e IGGY_CLUSTER_AUTH_SHARED_SECRET=<48-char secret> \
"${roster[@]}" <server image built from 4b3e5684b> --replica-id $i
done
iggy --transport tcp --tcp-server-address $SUB.10:8090 -u iggy -p iggy stream create s
iggy --transport tcp --tcp-server-address $SUB.10:8090 -u iggy -p iggy topic create s t 1 none unlimited --durability persisted
# Start a producer that retries every failed batch until acked (~150 msg/s, batches of 20), then:
sleep 15; docker kill -s KILL node-0; sleep 15; docker start node-0
docker logs -f node-0 2>&1 | grep -E 'holding partition entries|re-requesting remaining window'
# For the data loss, continue: kill node-1 at 45 s, start it at 60 s; kill node-2 at 75 s, start it at 90 s.We can share the full node logs and verifier output from any of these runs, rerun with a different |
Codecov Report❌ Patch coverage is ❌ Your patch check has failed because the patch coverage (6.92%) is below the target coverage (50.00%). You can increase the patch coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## master #4433 +/- ##
===========================================
Coverage 90.74% 90.75%
+ Complexity 2612 2609 -3
===========================================
Files 1405 1406 +1
Lines 330135 331489 +1354
Branches 281906 283263 +1357
===========================================
+ Hits 299576 300827 +1251
- Misses 24268 24349 +81
- Partials 6291 6313 +22
🚀 New features to boost your workflow:
|
|
/skill team-review-slim |
There was a problem hiding this comment.
Summary: The change holds entries journaled before the adopted view back from commit, acknowledgement, WAL persistence and segment flush until that view's anchor header proves them; the gate points hold, but the window proof still accepts an unsealed entry and a transferring adoption consumes the restart flag without fencing. The review also records repeated proof work on a broken fence, the failing rust-storage-compat lane, one robustness nit and four simplifications.
Counts: critical 0, warning 4, nit 1, simplification 4
Findings without an anchor on a changed line:
core/partitions/src/iggy_partition.rswarning: Therust-storage-compat/test-storage-compatcheck fails on this commit, and the change touches several paths that lane guards (core/server,core/consensus,core/partitions,core/shard). Get it green, or record why the failure is environmental.
This review was generated by Claude Code 2.1.284 on deepseek-flash[1m]. Review the output before you act on it.
c337511 to
06fc7bf
Compare
Closes #4284
Co-authored-by: Mark Aron Szulyovszky [email protected]