-
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 project’s main risk is a false positive: a check that rejects a legal transition aborts a real resharding operation. The cheapest place to find one is a service unit test that drives every legal path with the checks on. The donor and coordinator service unit tests already do this (resharding_donor_service_test.cpp:520, resharding_coordinator_service_test.cpp:744). The recipient’s do not, so a recipient rule that is wrong would first be found by a user, or by a long-running test, instead of by a unit test that names it.
Context
- The fixture is ReshardingRecipientServiceTest (resharding_recipient_service_test.cpp:744), a repl::PrimaryOnlyServiceMongoDTest (the donor’s fixture has the same base class), built into db_s_resharding_part3_test. It runs the real recipient state machine on a test service (ReshardingRecipientServiceForTest) with the external state and the data replication (cloning and applying) faked (ExternalStateForTest, DataReplicationForTest), so every transition is really written and the checks would really run. No new fixture is needed.
- isTransitionValidationEnabled (resharding_util.cpp:1143) is true only when the operation’s forwardable metadata carries a VersionContext and the flag is enabled at that pinned version. The fixture already provides the VersionContext: every test builds its state document through makeRecipientDocument, which sets one from the current FCV (resharding_recipient_service_test.cpp:820). Only the flag itself is missing.
- The donor and coordinator fixtures turn the flag on with a unittest::ServerParameterGuard member (resharding_donor_service_test.cpp:520, resharding_coordinator_service_test.cpp:744). The recipient fixture already has a guard member for another parameter (resharding_recipient_service_test.cpp:1494).]
- The checks are wired in SERVER-139806 (pre) and SERVER-139808 (post).
Proposed approach
- Add a unittest::ServerParameterGuard member for featureFlagReshardingPrePostConditionsValidations (value true) to the fixture next to the existing _batchSize guard (resharding_recipient_service_test.cpp:1494), as the donor and coordinator fixtures do. It applies to every test in the fixture. Keep the flag-off path covered with at least one end-to-end test that sets a test-local guard to false (the file already uses test-local guards for another flag).
- Run every existing recipient service unit test with the flag on. Treat each failure as either a validator false positive (fix the rule and add a unit test) or a service bug (file separately). Write down the failures with a verdict for each. A false positive appears as a tripwire, and the message names the failed rule and the transition.
- Cover the option combinations. The two broad tests, CanTransitionThroughEachStateToCompletion (resharding_recipient_service_test.cpp:1498) and StepDownStepUpEachTransition (resharding_recipient_service_test.cpp:1591), loop over makeBasicTestOptions() (resharding_recipient_service_test.cpp:569), which sets performVerification to false in all four cases, so the change-streams-monitor rules would not run through a whole operation. Add verification-on cases to those two tests, for example by iterating makeAllTestOptions() (resharding_recipient_service_test.cpp:591), which covers both values with the skip variants. Other tests already set performVerification themselves (the strict-consistency recovery tests and the change-streams-monitor tests).
- Abort at each state is covered by existing tests (UnrecoverableErrorDuringCreatingCollection, ...DuringCloning, ...DuringBuildingIndex, ...DuringApplying, FailoverDuringErrorState); they only need to run with the flag on.
- Step-down and step-up: StepDownStepUpEachTransition pauses each transition inside a test op observer while the state document is being written (resharding_service_test_helpers.h:154), before the write commits. It therefore covers recovery with the checks on (the new primary’s pre-check reads the document), but not a step-down after the write is durable and before the post-check runs. Covering that window needs a pause point after the majority wait in _transitionState.
- If adding one here is too large, track it with SERVER-139809, which adds its own fail point at the adjacent point in _transitionState (between the read and validation) for the post-check corruption.
- Confirm the recipient is exercised with the flag on by the existing resharding multiversion and upgrade/downgrade suites in the all-feature-flags variants (the technical design’s test plan relies on this), or file a ticket for the gap.
Acceptance criteria
- The recipient service unit tests pass with the flag on, and at least one end-to-end test passes with it off.
- CanTransitionThroughEachStateToCompletion and StepDownStepUpEachTransition also run with performVerification on.
- The resharding service unit test targets (parts 1, 2 and 3) all pass. Part 3 holds this fixture. Part 1 also references the recipient service and never turns the flag on; run it as a regression check that wiring the checks with the flag off changes nothing, since parts 2 and 3 set a VersionContext in their fixtures and missed an earlier defect.
- A written list of the failures found, with the verdict for each.
- Written confirmation of the multiversion and upgrade/downgrade coverage, or a ticket for the gap.
- is related to
-
SERVER-139809 Add a recipient corruption failpoint and negative tests for transition validation
-
- Backlog
-
- related to
-
SERVER-139808 Wire post-transition checks into the recipient state machine
-
- Backlog
-
-
SERVER-139891 Determine the post-check recipient failures which should lead to an abort
-
- Backlog
-
-
SERVER-139806 Wire pre-transition checks into the recipient state machine
-
- In Code Review
-