diff options
Diffstat (limited to 'src/mongo/db/s/drop_collection_coordinator.cpp')
-rw-r--r-- | src/mongo/db/s/drop_collection_coordinator.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/s/drop_collection_coordinator.cpp b/src/mongo/db/s/drop_collection_coordinator.cpp index 7061a240378..3510faf2e1d 100644 --- a/src/mongo/db/s/drop_collection_coordinator.cpp +++ b/src/mongo/db/s/drop_collection_coordinator.cpp @@ -68,11 +68,9 @@ DropReply DropCollectionCoordinator::dropCollectionLocally(OperationContext* opC csr->clearFilteringMetadataForDroppedCollection(opCtx); } - DropReply result; - uassertStatusOK(dropCollection( - opCtx, nss, &result, DropCollectionSystemCollectionMode::kDisallowSystemCollectionDrops)); - - // Remove all range deletion task documents present on disk for the dropped collection + // Remove all range deletion task documents present on disk for the collection to drop. This is + // a best-effort tentative considering that migrations are not blocked, hence some new document + // may be inserted before actually dropping the collection. if (collectionUUID) { // The multi-document remove command cannot be run in transactions, so run it using // an alternative client. @@ -97,6 +95,11 @@ DropReply DropCollectionCoordinator::dropCollectionLocally(OperationContext* opC } } + DropReply result; + uassertStatusOK(dropCollection( + opCtx, nss, &result, DropCollectionSystemCollectionMode::kDisallowSystemCollectionDrops)); + + // Force the refresh of the catalog cache to purge outdated information const auto catalog = Grid::get(opCtx)->catalogCache(); uassertStatusOK(catalog->getCollectionRoutingInfoWithRefresh(opCtx, nss)); |