test(dedup): make concurrent-append race deterministic#70
Conversation
Gate dedup_partition on the appender's first committed row before starting, so the appended>0 assertion can't fail as a scheduling artifact on a loaded CI runner. Switch the stop/commit flags to Release/Acquire and add the missing failure message on the post-dedup count assertion. Addresses review feedback on #68 (fix landed in master via #69).
Code Review — PR #70:
|
Addresses claude review on #70: the stop flag's store was still Relaxed while the load was Acquire — the Acquire had nothing to synchronize-with. Use Release on the store so the pairing is a correct stop-flag. Move the Ordering import to the top of the function body.
Code Review —
|
Addresses claude review on #70: if the appender panics before its first commit, the spin-wait on committed==0 would hang forever and never reach appender.await?. Wrap it in tokio::time::timeout so the panic surfaces as a loud failure instead of a hung CI job.
Context
Follow-up to the closed #68. The
delta_commit_lockfix and itsdedup_commits_despite_concurrent_appendsregression test both landed on master via #69 (c28f2bf) — #68 was a parallel duplicate and is closed. This PR applies the still-actionable review feedback from #68's Claude review to the test as it now lives in master.Changes
dedup_partitionon the appender's first committed row before starting. Previouslyassert!(appended > 0)could fail as a scheduling artifact if dedup finished before the spawned appender task was scheduled on a loaded 4-thread runner — a failure for the wrong reason.Release/Acquireinstead ofRelaxed(idiomatic stop-flag intent).Not addressed (intentional): the per-
Databaselock granularity flagged in review is a deliberate design choice — commits are sub-second vs the 10-min flush cadence, so global serialization is acceptable and simpler than per-table locks.Test
cargo test --test dedup_compaction_test dedup_commits_despite_concurrent_appendspasses (1.8s). Test-only change; no production code touched.🤖 Generated with Claude Code