[SERVER-53653] [Resharding] Take the critical section when renaming on recipient shards Created: 08/Jan/21  Updated: 29/Oct/23  Resolved: 05/May/21

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

Type: Task Priority: Major - P3
Reporter: Blake Oler Assignee: Sergi Mateo Bellido
Resolution: Fixed Votes: 0
Labels: PM-234-M2, PM-234-T-lifecycle
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
depends on SERVER-53258 [Resharding] Reject writes in opObser... Closed
is depended on by SERVER-56659 Use local write concern when acquirin... Closed
Problem/Incident
Related
related to SERVER-56612 Use the resharding-specific refresh f... Closed
related to SERVER-56785 Critical section is wrongly reacquire... Closed
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2021-03-22, Sharding 2021-04-05, Sharding EMEA 2021-05-03, Sharding EMEA 2021-05-17
Participants:
Linked BF Score: 141
Story Points: 2

 Description   

Background

After a coordinator transitions to kRenaming, there exists a potential gap in-between these two events:

  1. The recipient shard updates its routing info, and
  2. The recipient shard renames the collection locally.

In this gap, it's possible that a router can attempt to read from this collection when the collection doesn't actually exist at the storage level. This might culminate in a NamespaceNotFound error, which isn't considered retryable.

Solution

In order to prevent this, on a given recipient shard, we will need to take the CSR's critical section from before the point in which the refresh completes, up until the rename itself has been completed.

To do this, create a resharding-specific RAII type that can be fed a new opCtx for entering/exiting the critical section. As part of the destruction of this RAII type, it's important to leave the critical section, so that if the resharding operation errors out, the shard isn't permanently stuck in the critical section.



 Comments   
Comment by Githook User [ 05/May/21 ]

Author:

{'name': 'Sergi Mateo Bellido', 'email': 'sergi.mateo-bellido@mongodb.com', 'username': 'smateo'}

Message: SERVER-53653 [Resharding] Take the critical section when renaming on recipient shards
Branch: master
https://github.com/mongodb/mongo/commit/70d2f7fb8f378b667ace89da18c69ebcfcfc4551

Comment by Githook User [ 13/Apr/21 ]

Author:

{'name': 'Sergi Mateo Bellido', 'email': 'sergi.mateo-bellido@mongodb.com', 'username': 'smateo'}

Message: SERVER-53653 [Resharding] Take the critical section when renaming on recipient shards

Have donor role perform rename if also a recipient
Branch: master
https://github.com/mongodb/mongo/commit/815d4e362bac8a5113d7102d1b717ceeab1f233e

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