summaryrefslogtreecommitdiff
path: root/src/mongo/db/catalog/collection_compact.cpp
diff options
context:
space:
mode:
authorHaley Connelly <haley.connelly@10gen.com>2019-08-28 21:18:09 +0000
committerevergreen <evergreen@mongodb.com>2019-08-28 21:18:09 +0000
commit57b811d78e85c9edfdabb8fe1c915be7ddd03eff (patch)
treebf17d7006addb59216cc5a1d0faf1153188f8cbc /src/mongo/db/catalog/collection_compact.cpp
parentb00ddb01418db49a51ee59101583670341ae02b4 (diff)
downloadmongo-57b811d78e85c9edfdabb8fe1c915be7ddd03eff.tar.gz
SERVER-41853 Remove unused CompactStats class
Diffstat (limited to 'src/mongo/db/catalog/collection_compact.cpp')
-rw-r--r--src/mongo/db/catalog/collection_compact.cpp39
1 files changed, 16 insertions, 23 deletions
diff --git a/src/mongo/db/catalog/collection_compact.cpp b/src/mongo/db/catalog/collection_compact.cpp
index 110e8497bda..fc1cbb9e628 100644
--- a/src/mongo/db/catalog/collection_compact.cpp
+++ b/src/mongo/db/catalog/collection_compact.cpp
@@ -70,9 +70,7 @@ Collection* getCollectionForCompact(OperationContext* opCtx,
} // namespace
-StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
- const NamespaceString& collectionNss,
- const CompactOptions* compactOptions) {
+Status compactCollection(OperationContext* opCtx, const NamespaceString& collectionNss) {
AutoGetDb autoDb(opCtx, collectionNss.db(), MODE_IX);
Database* database = autoDb.getDb();
uassert(ErrorCodes::NamespaceNotFound, "database does not exist", database);
@@ -90,10 +88,9 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
OldClientContext ctx(opCtx, collectionNss.ns());
if (!recordStore->compactSupported())
- return StatusWith<CompactStats>(ErrorCodes::CommandNotSupported,
- str::stream()
- << "cannot compact collection with record store: "
- << recordStore->name());
+ return Status(ErrorCodes::CommandNotSupported,
+ str::stream() << "cannot compact collection with record store: "
+ << recordStore->name());
if (recordStore->supportsOnlineCompaction()) {
// Storage engines that allow online compaction should do so using an intent lock on the
@@ -105,24 +102,22 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
recordStore = collection->getRecordStore();
}
- log(LogComponent::kCommand) << "compact " << collectionNss
- << " begin, options: " << *compactOptions;
+ log(LogComponent::kCommand) << "compact " << collectionNss << " begin";
auto indexCatalog = collection->getIndexCatalog();
if (recordStore->compactsInPlace()) {
- CompactStats stats;
Status status = recordStore->compact(opCtx);
if (!status.isOK())
- return StatusWith<CompactStats>(status);
+ return status;
// Compact all indexes (not including unfinished indexes)
status = indexCatalog->compactIndexes(opCtx);
if (!status.isOK())
- return StatusWith<CompactStats>(status);
+ return status;
log() << "compact " << collectionNss << " end";
- return StatusWith<CompactStats>(stats);
+ return status;
}
invariant(opCtx->lockState()->isCollectionLockedForMode(collectionNss, MODE_X));
@@ -147,9 +142,9 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
const Status keyStatus =
index_key_validate::validateKeyPattern(key, descriptor->version());
if (!keyStatus.isOK()) {
- return StatusWith<CompactStats>(
- ErrorCodes::CannotCreateIndex,
- str::stream() << "Cannot compact collection due to invalid index " << spec
+ return Status(ErrorCodes::CannotCreateIndex,
+ str::stream()
+ << "Cannot compact collection due to invalid index " << spec
<< ": " << keyStatus.reason() << " For more info see"
<< " http://dochub.mongodb.org/core/index-validation");
}
@@ -169,8 +164,6 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
wunit.commit();
}
- CompactStats stats;
-
MultiIndexBlock indexer;
indexer.ignoreUniqueConstraint(); // in compact we should be doing no checking
@@ -180,16 +173,16 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
Status status =
indexer.init(opCtx, collection, indexSpecs, MultiIndexBlock::kNoopOnInitFn).getStatus();
if (!status.isOK())
- return StatusWith<CompactStats>(status);
+ return status;
status = recordStore->compact(opCtx);
if (!status.isOK())
- return StatusWith<CompactStats>(status);
+ return status;
log() << "starting index commits";
status = indexer.dumpInsertsFromBulk(opCtx);
if (!status.isOK())
- return StatusWith<CompactStats>(status);
+ return status;
{
WriteUnitOfWork wunit(opCtx);
@@ -198,13 +191,13 @@ StatusWith<CompactStats> compactCollection(OperationContext* opCtx,
MultiIndexBlock::kNoopOnCreateEachFn,
MultiIndexBlock::kNoopOnCommitFn);
if (!status.isOK()) {
- return StatusWith<CompactStats>(status);
+ return status;
}
wunit.commit();
}
log() << "compact " << collectionNss << " end";
- return StatusWith<CompactStats>(stats);
+ return Status::OK();
}
} // namespace mongo