Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-61849

Make collection defragmenter cleanup asyncronous

    • Type: Icon: Task Task
    • Resolution: Won't Do
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Sharding EMEA

      The current cleanup of the defragmentation state is done in BalancerDefragmentationPolicyImpl::refreshCollectionDefragmentationStatus. As part of the defragmentation state cleanup we perform the removal of the data size estimation from all the chunks, for collection with millions of chunks this could take up to seconds.Currently the cleanup is done synchronously in BalancerDefragmentationPolicyImpl::refreshCollectionDefragmentationStatus and it will block the balancer round and the streaming action (since we are holding the _streamingMutex lock).

      My proposal is to introduce an ad-hoc defragmentation phase that will be responsible for performing the cleanup procedure. So that we can execute it asyncornously.

      Regarding the interruption of the defragmentation process I would structure it as follows:
      1. refreshCollectionDefragmentationStatus set an interrupted flag on the collectionState
      2. All the phases will stop producing actions if the interrupted flag is enabled and will eventually move to the subsequent phase.
      3. The last phase will execute the clear of the data size
      4. When all the phases are completed we can clear the collection entry in config.collections and remove the state from the _defragmentationState map

            Assignee:
            backlog-server-sharding-emea [DO NOT USE] Backlog - Sharding EMEA
            Reporter:
            tommaso.tocci@mongodb.com Tommaso Tocci
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: