[SERVER-57641] Legacy renameCollection may proceed renaming a sharded collection Created: 11/Jun/21  Updated: 29/Oct/23  Resolved: 15/Jun/21

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 5.0.0-rc1
Fix Version/s: 5.0.0-rc3, 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Jordi Serra Torrens Assignee: Jordi Serra Torrens
Resolution: Fixed Votes: 0
Labels: None
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:
v5.0
Sprint: Sharding EMEA 2021-06-28
Participants:
Linked BF Score: 120

 Description   

The legacy-path renameCollection must fail if either the source or the destination collections are sharded.
It does so by checking if the filtering metadata has the collection as sharded or not.

There is a situation where after a shardCollection operations has completed writing the config.chunks and config.collections documents, but then steps down before refreshing the filtering metadata, where the new primary may be left with filtering metadata as unsharded. Under that scenario, a legacy-path rename may succeed in renaming a sharded collection.



 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 [ 16/Jun/21 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-57641 Legacy renameCollection may proceed renaming a sharded collection

(cherry picked from commit d5ab25a22cdfd7d60aedae5fb3e455502e330bdb)
Branch: v5.0
https://github.com/mongodb/mongo/commit/d337b8db00509ecc8eeb8f9002ffd92778ed8bbe

Comment by Githook User [ 15/Jun/21 ]

Author:

{'name': 'Jordi Serra Torrens', 'email': 'jordi.serra-torrens@mongodb.com', 'username': 'jordist'}

Message: SERVER-57641 Legacy renameCollection may proceed renaming a sharded collection
Branch: master
https://github.com/mongodb/mongo/commit/d5ab25a22cdfd7d60aedae5fb3e455502e330bdb

Comment by Jordi Serra Torrens [ 11/Jun/21 ]

kaloian.manassiev no, most likely this situation exists prior to 5.0

Comment by Kaloian Manassiev [ 11/Jun/21 ]

jordi.serra-torrens, this is not something new to 5.0, right?

Comment by Jordi Serra Torrens [ 11/Jun/21 ]

To address this, in legacy-rename, instead of assessing if the collections are sharded using the CollectionShardingState, we could do it by refreshing and checking the catalog metadata from the configsvr.

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