Make get_version_of_previous_write ordering test less probabilistic - #8262
Open
Amaury Chamayou (achamayou) wants to merge 4 commits into
Open
Make get_version_of_previous_write ordering test less probabilistic#8262Amaury Chamayou (achamayou) wants to merge 4 commits into
Amaury Chamayou (achamayou) wants to merge 4 commits into
Conversation
Replace the fixed 64x100 write workload in the "get_version_of_previous_write ordering" unit test with a bounded, stop-on-first-conflict harness. Worker threads start together via a ready/start gate, then repeatedly call point_at_previous_write until an atomic stop flag is set. The main thread waits until a conflict is observed or a 5 second steady_clock deadline elapses, then signals stop and joins all workers. Whether the conflict was seen before the deadline is recorded separately so a late conflict during drain does not mask a timeout. last_write_version is now derived from kv_store.current_version() after joining, since writes_per_thread no longer exists. Closes #6640 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Amaury Chamayou (achamayou)
September 2, 2026 11:13
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is test-only and the new bounded harness aligns with the linked issue’s intent; the remaining feedback is a minor robustness improvement in test assertion strictness.
Pull request overview
Updates the KV contention unit test for get_version_of_previous_write ordering to reduce probabilistic failures by replacing a fixed-workload stress pattern with a bounded “run until first conflict (or timeout)” harness.
Changes:
- Replace fixed thread/write-count loop with worker threads that retry
point_at_previous_write()until a shared stop flag is set. - Add a coordinated start gate so contention begins simultaneously across worker threads.
- Cap runtime with a steady-clock deadline and derive
last_write_versionfromkv_store.current_version()after joining workers.
Custom instructions used:
.github/copilot-instructions.md
File summaries
| File | Description |
|---|---|
src/kv/test/kv_contention.cpp |
Refactors the ordering contention test to stop after observing the first conflict (or hitting a deadline), reducing flakiness while preserving post-run chain validation. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Stop the test at the primary timeout failure rather than continuing into assertions that assume a conflict occurred. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Amaury Chamayou (achamayou)
enabled auto-merge (squash)
September 2, 2026 12:16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #6640
Replaces the fixed 64-thread / 100-writes-per-thread workload in the get_version_of_previous_write ordering unit test with a bounded, stop-on-first-conflict harness.
Validated by building kv_test and running the test repeatedly; formatting/ascii/copyright checks pass. No changelog entry needed (test-only).