[SERVER-58781] ReshardingCoordinatorObserver should not fulfill promises if the "donors" or "recipients" fields are empty Created: 22/Jul/21  Updated: 29/Oct/23  Resolved: 10/Aug/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 5.0.3, 5.1.0-rc0

Type: Task Priority: Major - P3
Reporter: Janna Golden Assignee: Matthew Walak (Inactive)
Resolution: Fixed Votes: 0
Labels: PM-234-M3, PM-234-T-lifecycle
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Duplicate
is duplicated by SERVER-58782 ReshardingCoordinatorObserver should ... Closed
is duplicated by SERVER-58783 ReshardingCoordinatorObserver should ... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v5.0
Sprint: Sharding 2021-08-09, Sharding 2021-08-23
Participants:
Linked BF Score: 119
Story Points: 1

 Description   

The following scenario causes the coordinator to invariant:
1. Coordinator inserts the resharding coordinator document and is in the initializing state. The "donors" and "recipients" fields are empty.
2. Coordinator failover/stepdown etc.
3. New coordinator steps up, and rebuilds all primary only service instances.
4. A ReshardingCoordinator instance is reconstructed, and is in initializing state. ReshardingCoordinatorObserver::onReshardingParticipantTransition is called.
5. Every promise on the ReshardingCoordinator is fulfilled, because allParticipantsInStateGTE will return "true" when the participant list that is passed in is empty.
6. ReshardingCoordinator run function begins, and the _awaitAllDonorsReadyToDonate promise will already be fulfilled. The ReshardingCoordinator will call getHighestMinFetchTimestamp() with the empty donors list, and then invariant.

The coordinator should either not tell the ReshardingCoordinatorObserver to fulfill promises in it's constructor unless it's state is > initializing, or the ReshardingCoordinatorObserver should check whether the participants lists are empty and return that all participants are not in the desired state (or both).

Repro:
https://mongodbcr.appspot.com/820160487/



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 12/Aug/21 ]

Author:

{'name': 'Matt Walak', 'email': 'matt.walak@mongodb.com'}

Message: SERVER-58781 ReshardingCoordinatorObserver should not fulfill promises when stepping up in state kInitializing
Branch: v5.0
https://github.com/mongodb/mongo/commit/407ebc679c51541204fdacb736ae0399c45bc78b

Comment by Githook User [ 10/Aug/21 ]

Author:

{'name': 'Matt Walak', 'email': 'matt.walak@mongodb.com'}

Message: SERVER-58781 ReshardingCoordinatorObserver should not fulfill promises when stepping up in state kInitializing
Branch: master
https://github.com/mongodb/mongo/commit/9d42ee121ff1afab958a3ecd6c4ff0ea445722b4

Generated at Thu Feb 08 05:45:26 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.