[SERVER-76801] Make MovePrimaryDonor::onBeganBlockingWrites() Idempotent Created: 03/May/23  Updated: 29/Oct/23  Resolved: 04/May/23

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 7.0.0-rc0, 7.1.0-rc0
Fix Version/s: 7.1.0-rc0, 7.0.0-rc1

Type: Bug Priority: Major - P3
Reporter: Brett Nawrocki Assignee: Brett Nawrocki
Resolution: Fixed Votes: 0
Labels: sharding-nyc-subteam1
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: Sharding NYC 2023-05-15
Participants:
Linked BF Score: 135

 Description   

It's possible for the ShardingDDLCoordinator to receive a PrimarySteppedDown error and retry before its stepdown token is cancelled to prevent the retry. If this happens while the MovePrimaryCoordinator is in the kCatchup phase, it is possible that it calls MovePrimaryDonor::onBeganBlockingWrites() multiple times, triggering an invariant by setting the promise twice.

Similarly to MovePrimaryDonor::onReadyToForget(), MovePrimaryDonor::onBeganBlockingWrites() should do nothing if the promise was already set.

Despite the fact that the critical section is taken by the coordinator with local write concern, the donor does not transition to blocking writes until it persists the blocking timestamp with majority write concern. In other words, there is no risk that acquiring the critical section is rolled back while the donor believes that it is still held because both the coordinator and donor are running on the same node.



 Comments   
Comment by Githook User [ 04/May/23 ]

Author:

{'name': 'Brett Nawrocki', 'email': 'brett.nawrocki@mongodb.com', 'username': 'brettnawrocki'}

Message: SERVER-76801 Make MovePrimaryDonor::onBeganBlockingWrites() Idempotent

(cherry picked from commit aed68b23fdcf10abdf242e4351c140705026f626)
Branch: v7.0
https://github.com/mongodb/mongo/commit/6356d1e29db503ac68a31c8d61624ba4881f5a97

Comment by Githook User [ 03/May/23 ]

Author:

{'name': 'Brett Nawrocki', 'email': 'brett.nawrocki@mongodb.com', 'username': 'brettnawrocki'}

Message: SERVER-76801 Make MovePrimaryDonor::onBeganBlockingWrites() Idempotent
Branch: master
https://github.com/mongodb/mongo/commit/aed68b23fdcf10abdf242e4351c140705026f626

Generated at Thu Feb 08 06:33:39 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.