-
Type:
Task
-
Resolution: Unresolved
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Cluster Scalability
-
2
-
None
-
None
-
None
-
None
-
None
-
None
-
None
Motivation
The checks are only worth having if they fire when something is wrong, and a check that no test has ever seen fail is not known to work. The donor and the coordinator each have a failpoint that corrupts the state just before it is validated, and service unit tests that use it to show the wiring reacts correctly. The recipient has neither. Without them nothing shows that the recipient’s pre-check really aborts the operation, that its checks on aborting and completing really leave the recipient able to record its failure or finish, or that a failed post-check really leaves the transition intact. A false negative here means a broken recipient would pass the checks silently.
Context
- The donor’s failpoint is reshardingDonorCorruptContextBeforeValidation; its data selects pre or post validation (post: true) and the destination state (state: <int>). The donor’s tests use it with unittest::TassertGuard tassertGuard(1), which expects and clears the tripwire a failed check records. Example: resharding_donor_service_test.cpp:595. The coordinator’s equivalent is reshardingCoordinatorCorruptDocBeforeValidation.
- The recipient checks are wired in SERVER-139806 (pre) and SERVER-139808 (post). The post-check’s failure policy, and why the check for kStrictConsistency must not throw, are described there.
Proposed approach
- Add the failpoint reshardingRecipientCorruptContextBeforeValidation in the recipient service, with the donor’s data shape. Pre: corrupt the proposed snapshot after the change-streams monitor context is attached and before the check. Post: corrupt the durable snapshot between the read and the validation (the seam left by SERVER-139808). Corrupt a field a rule actually compares, and say which in a comment.
- Tests, with the flag on and TassertGuard(1):
-
- A pre-check violation on a transition before kStrictConsistency aborts the recipient through kError; the abort reason has code ReshardingPreconditionFailure.
- A pre-check violation on the kStrictConsistency transition aborts through kError and the critical section is released (the recipient had already acquired it just before that transition).
- A pre-check violation on kError or kDone only fires the tripwire; the recipient still records its failure or finishes.
- A post-check violation fires the tripwire without interrupting the transition. For kStrictConsistency, the strict-consistency oplog entry is still written (this is the hazard behind the no-throw policy in SERVER-139808).
- A failure to read the document back logs a warning and produces no violation, if the fixture can inject it. Otherwise record the gap here (carried over from SERVER-139808).
Acceptance criteria
- Each test fails when the check it exercises is removed.
- The failpoint does nothing when not enabled.
- The resharding service unit test targets (parts 1, 2 and 3) pass.
- is related to
-
SERVER-139806 Wire pre-transition checks into the recipient state machine
-
- In Code Review
-
- related to
-
SERVER-139808 Wire post-transition checks into the recipient state machine
-
- Backlog
-
-
SERVER-139810 Run recipient service unit tests with transition validation enabled
-
- Backlog
-
-
SERVER-139891 Determine the post-check recipient failures which should lead to an abort
-
- Backlog
-
-
SERVER-139894 Add a flag-on end-to-end jstest for recipient transition validation
-
- Backlog
-