The MongoDB replica rewrite-cache test pauses replication before the write it checks #352

Closed
opened 2026-11-06 14:24:13 -05:00 by claude · 0 comments
Owner
  • Draft: none (found while verifying #278, 2026-11-06)
  • Priority: medium (a flaky CI test blocks merges)
  • Agent: storage-coder
  • Depends on: #278
  • Decisions: none

Why

MongoDbReplicaWebHostTests.RewriteCache_RightAfterAnApiSaveWhileReplicationIsPaused_AnswersFromThePrimary failed in pull-request run 1269 (on asgard, under heavy load).

  • MongoDbReplicaSetEngineHost.PauseReplicationAsync uses the pauseBatchApplicationBeforeCompletion failpoint (alwaysOn), which holds a batch only before it completes.
  • A batch that had already started can still apply the write to the secondary, so the replica-read Assert.DoesNotContain (ReplicaWebHostTestsBase.cs, test at about line 444) can see the row.
  • WaitForCatchUpAsync is not used around the pause. This is a hypothesis from the code; it was not reproduced.

What changes

  • Make the pause certain before the save. For example, wait for the secondary to report the failpoint as hit, or confirm the secondary's applied optime is older than the write before asserting.
  • Use whichever is documented by MongoDB for the server version the engine host pins.

Acceptance

  • The test passes 10 times in a row with Docker on asgard (at normal load), and the race is explained in a comment.
- **Draft:** none (found while verifying #278, 2026-11-06) - **Priority:** medium (a flaky CI test blocks merges) - **Agent:** storage-coder - **Depends on:** #278 - **Decisions:** none ### Why `MongoDbReplicaWebHostTests.RewriteCache_RightAfterAnApiSaveWhileReplicationIsPaused_AnswersFromThePrimary` failed in pull-request run 1269 (on asgard, under heavy load). - `MongoDbReplicaSetEngineHost.PauseReplicationAsync` uses the `pauseBatchApplicationBeforeCompletion` failpoint (`alwaysOn`), which holds a batch only before it completes. - A batch that had already started can still apply the write to the secondary, so the replica-read `Assert.DoesNotContain` (`ReplicaWebHostTestsBase.cs`, test at about line 444) can see the row. - `WaitForCatchUpAsync` is not used around the pause. This is a hypothesis from the code; it was not reproduced. ### What changes - Make the pause certain before the save. For example, wait for the secondary to report the failpoint as hit, or confirm the secondary's applied optime is older than the write before asserting. - Use whichever is documented by MongoDB for the server version the engine host pins. ### Acceptance - [ ] The test passes 10 times in a row with Docker on asgard (at normal load), and the race is explained in a comment.
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
lantea-one/ninlil#352
No description provided.