[SERVER-45024] Refactor the CollectionRangeDeleter to remove dependency on MetadataManager Created: 09/Dec/19  Updated: 29/Oct/23  Resolved: 15/Jan/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.3.3

Type: Task Priority: Major - P3
Reporter: Matthew Saltz (Inactive) Assignee: Matthew Saltz (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by SERVER-43688 Race in range deleter can trigger inv... Closed
is depended on by SERVER-45249 Make recipient wait for orphan cleanu... Closed
Problem/Incident
Backwards Compatibility: Fully Compatible
Sprint: Sharding 2019-12-16, Sharding 2019-12-30, Sharding 2020-01-13, Sharding 2020-01-27
Participants:
Linked BF Score: 32

 Description   

The CollectionRangeDeleter is currently extremely complex to reason about. Its main function is a static function that then calls back into a friend class (the MetadataManager) to access an instance of CollectionRangeDeleter, and it has to acquire and release locks to ensure the continued validity of the MetadataManager state as it processes a range. In addition, the logic for scheduling tasks is very complex and spread across a lot of code. It's all very brittle and making changes is extremely difficult.

We should refactor it so that:
1) The logic for looping over a batch of documents within a range is clear and consolidated
2) The logic for cleaning up a range does not rely on the MetadataManager
3) No collection locks are required except for doing the actual deletion of documents
4) The logic for scheduling a range for delayed deletion is simplified
5) The functionality is equivalent



 Comments   
Comment by Githook User [ 15/Jan/20 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-45024 Integrate refactored range deletion functionality and remove CollectionRangeDeleter
Branch: master
https://github.com/mongodb/mongo/commit/c9dbf657e1ef0fdda8a32d1080d4a7c3bb361c5e

Comment by Githook User [ 13/Jan/20 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-45024 Add new function to handle range deletion
Branch: master
https://github.com/mongodb/mongo/commit/47807fb33949b06d005a55276e3e394b65649713

Comment by Githook User [ 10/Jan/20 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-45024 Introduce future utilities for looping/sleeping
Branch: master
https://github.com/mongodb/mongo/commit/ff3e5489b29405fe10684ec86bbedf6979dec17d

Comment by Githook User [ 31/Dec/19 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-45024 Make the MetadataManager a non-reusable object
Branch: master
https://github.com/mongodb/mongo/commit/3b2a7ee28a282bcfd2b329443ed4f5a2130b11f3

Comment by Githook User [ 18/Dec/19 ]

Author:

{'name': 'Matthew Saltz', 'email': 'matthew.saltz@mongodb.com', 'username': 'saltzm'}

Message: SERVER-45024 Move CollectionShardingState implementation into CollectionShardingRuntime
Branch: master
https://github.com/mongodb/mongo/commit/cd4e921ca0b4bed008b1a91b687f697aac629798

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