perf: log-store: append the whole batch in one WriteBatch #17
All Vouch review confidence checks passed
Residual risk 0.17 = Change Risk (0.39) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 242 lines diff across 3 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.329
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #17"
general
weight: 0.35
lichuang
Finding
O-11 —
appendwrites oneput_cfper entry.src/raft/store/log_store.rs:OpenRaft hands
appenda wholeAppendEntriesbatch — up tomax_payload_entries(default 300) — and this turned each one into 300independent writes, 300 WAL appends and 300 memtable inserts.
How to reproduce
Instrument
RocksLogStore::append(orDB::put/DB::write) and run anyreplication: a single batch of 300 entries shows 300
put_cfcalls from oneappend.The fix
The write stays inside
appendrather than moving into the flush task, becauseOpenRaft requires the entries to be readable as soon as
appendreturns. Theflush and the
IOFlushedcallback are untouched:flush_wal(true)still runs ina blocking task and still reports completion.
Two wins beyond the call count:
batch durable, i.e.
get_log_state()reporting a log that is missing entriesthe leader had already accepted (safe — Raft reconciles it — but it makes every
partial append a conflict to resolve). One
WriteBatchis all-or-nothing.Test:
test_append_is_readable_on_return— entries andget_log_state()agreeimmediately after
appendreturns, and an empty append is a no-op.Verified:
cargo fmt --all -- --check,cargo clippy --all-features -- -D,warnings
cargo test --lib→ 110 passed.<!-- x-pr-ship -->