This assertion checks that the number of orphaned documents for a collection is always at most equal to the total number of documents in the collection itself.
The assertion must be removed because it is transiently allowed for the tracked number of orphaned docs to be greater than the number of documents actually contained in the collection. The reason behind that is that the number of orphaned documents is not decremented during a range deletion but only when it finishes.
Example:
- Collection has 1K documents in total, all belonging to a single chunk being migrated off (numOrphans = 0, numDocs=1K)
- Migration ends (numOrphans = 1K, numDocs=1K)
- Range deletion starts (numOrphans = 1K, numDocs=1K)
- Range deletion is ongoing, half orphans were deleted (numOrphans = 1K, numDocs=500)
- Range deletion ends (numOrphans = 0, numDocs=0)