diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/collection_compact.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/mongo/db/catalog/collection_compact.cpp b/src/mongo/db/catalog/collection_compact.cpp index 60c06b561e0..ab41a04327c 100644 --- a/src/mongo/db/catalog/collection_compact.cpp +++ b/src/mongo/db/catalog/collection_compact.cpp @@ -88,6 +88,8 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx, auto recordStore = collection->getRecordStore(); auto indexCatalog = collection->getIndexCatalog(); + OldClientContext ctx(opCtx, collectionNss.ns()); + if (!recordStore->compactSupported()) return StatusWith<CompactStats>(ErrorCodes::CommandNotSupported, str::stream() @@ -103,7 +105,6 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx, collection = getCollectionForCompact(opCtx, database, collectionNss); } - OldClientContext ctx(opCtx, collectionNss.ns()); log(LogComponent::kCommand) << "compact " << collectionNss << " begin, options: " << *compactOptions; |