The defragmenter in phase1 ("MergeAndMesure") issue dataSize commands to the shard in order to estimate the size of the chunks.
Phase2 use this estimation to:
- ignore all the chunks bigger than a certain threshold
- order and process all the remaining chunks from the smaller to the bigger.
Since we need an estimation of the data size just for smaller chunks we can avoid calculating it for the bigger ones (they will be ignored by phase 2 in any case).
In order to so we could send the dataSize command with the maxSize parameter so that if the shard reach this limit it will stop scanning the index and will set the maxReached flag in the reply.