Repository navigation
[Tests] Start the fuzzy region checkpoints only once every transaction writer is committing - #2211
Merged
Merged
Conversation
âĶ is committing The checkpoint loop is over in about four seconds - it is mostly WaitUntilNextSecond waiting out the one second resolution of LASTSAVE - while each writer first has to establish a multiplexer, a blocking call over async plumbing that four threads were making at once. A writer still connecting when the last checkpoint finished committed nothing, and because AbortOnConnectFail is false and the loop tests cancellation before its first commit, it then exited cleanly: the task completed, WaitAll stayed silent, and the only symptom was a zero count reported as 'no transactions were committed'. The checkpoints now wait for every writer to commit, which both removes the race and makes each checkpoint overlap live traffic rather than an idle primary. A writer that cannot commit faults that wait, so the cause is reported instead of an absent increment; the wait has its own timeout and message; writers are joined on every path, since a multiplexer left alive reconnects to whichever server next binds the port; and SyncTimeout is raised from the five second default, which a transaction of several hundred commands issued during a checkpoint can exceed.
Ted Hart (TedHartMS)
requested review from
Vasileios Zois (vazois)
and
a balanced review from Copilot
October 7, 2026 00:03
Contributor
There was a problem hiding this comment.
Copilot review overview
ðĄ Changes recommended
A startup timeout can still hide the underlying writer exception during cleanup.
Review effort: Balanced
Findings: 1
Open (1)
What changed in this PR
Stabilizes the cluster fuzzy-region replication test by waiting for every transaction writer to commit before starting checkpoints. No product code changes.
Changes:
- Adds per-writer readiness signals and a startup timeout.
- Joins writers on success and failure paths.
- Increases transaction and fixture timeouts for loaded runners.
| File | Description |
|---|---|
| test/âcluster/âGarnet.test.cluster.replication/âReplicationTests/âClusterReplicationFuzzyRegionTxnTests.cs | Coordinates writer startup, cleanup, and timeout handling. |
ðĄ Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Vasileios Zois (vazois)
approved these changes
Oct 8, 2026
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.

Root Cause
ClusterReplicationFuzzyRegionTxnTests.TransactionCommittedDuringPrimaryCheckpointReachesReplicafailed intermittently in CI with:The test started four writer tasks and immediately entered its checkpoint loop. Instrumented locally, that loop finishes in ~4.2 s â it is mostly
WaitUntilNextSecondwaiting out the one second resolution ofLASTSAVE, not checkpoint work â while each writer must first complete a blockingConnectionMultiplexer.Connect(ConnectTimeout = 5000, four at once from the thread pool, sync over async).A writer still connecting when
stop.Cancel()fired then tested the token before its first commit and exited cleanly:Task.WaitAllreported nothing;AbortOnConnectFail = falsemeant a failed connect did not throw either.So the only symptom was a zero increment count, surfacing as a misleading "no transactions were committed" well after the actual problem. Delaying writer startup past the loop reproduces the CI message exactly.
Description of Change
Test only. The checkpoints now wait for every writer to commit a transaction before the first
BGSAVE.Key changes:
TaskCompletionSourceafter its first successful commit, and the checkpoint loop waits on all of them before starting. This removes the race and also strengthens the test: previously the early checkpoints could run against an idle primary, which is the opposite of what the fixture exists to cover.writers did not start committing transactions within ...), so a genuine startup stall is no longer misreported as a zero count.AbortOnConnectFail = false, which once abandoned reconnects to whichever server next binds that port, and every cluster fixture in this assembly binds the same ports â the hazard already documented onClusterLargeTransactionSlotTests.redis.CancellationTokenargument toTask.Run. It only added a cancel-before-start state that surfaces as a confusingTaskCanceledException; the delegate observes the token itself, and a writer that never runs would leave the new wait hanging.SyncTimeoutoff the 5 s default: a transaction of several hundred commands issued while the primary is checkpointing can exceed it on a loaded machine.ClusterTestContext's deadline (which surfaces asBackOffâAssert.Fail("Cancellation Requested")).Key Technical Details
Affected types:
ClusterReplicationFuzzyRegionTxnTestsâ the only file changed.ClusterTestContext.Setup(monitorTests, testTimeoutSeconds)â existing parameter, now passed explicitly.No product code is touched.
What NOT to Do (for future agents)
ConnectionMultiplexer.Connectblocks on async plumbing; several at once from the thread pool take seconds on a small CI runner, and this loop is over in about four.Task.WaitAllto surface a worker's problems when the worker's loop condition can be false on its first check. The task completes normally and the failure is silent.CancellationTokentoTask.Runfor a worker that already observes it. It only adds a cancel-before-start path that reports as aTaskCanceledExceptionfrom an unrelatedWaitAll.Validation
net8.0andnet10.0;dotnet format --verify-no-changesclean.