This task is to thread-through the creation and cleanup of the CollectionRangeDeleter object. A single instance must exist at any given time, if and only if there are entries in the MetadataManager::_rangesToClean object and it should be created the first time an entry is put in there.
You'll need to implement the following:
CollectionRangeDeleter::run() { if (cleanupNext()) (range deleter task executor).scheduleTask() else delete this }
And in MetadataManager, you'll need to create the CollectionRangeDeleter and schedule the task in MetadataManager::addToRTC, which should do so if the rangesToClean was previously empty. The CollectionRangeDeleter should be created on the heap, and then CollectionRangeDeleter::run() will handle deleting it when it is finished.
Once that is implemented, we'll need to figure out how to clean up the CollectionRangeDeleter object when the server crashes/shutsdown/something bad happens to the scheduled task on the task executor.
This also involves writing unit-tests.
- has to be done after
-
SERVER-25011 Add a single-thread task executor for cleaning up orphaned ranges
- Closed
-
SERVER-25238 Change initialization of ShardingState::_rangeDeleterTaskExecutor to make the NetworkInterface externally settable for testing.
- Closed
- is related to
-
SERVER-24573 Implement CollectionRangeDeleter range deletion logic
- Closed
- related to
-
SERVER-28838 Coverity analysis defect 101169: Wrapper object use after free
- Closed