summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage')
-rw-r--r--src/mongo/db/storage/kv/durable_catalog_test.cpp1
-rw-r--r--src/mongo/db/storage/storage_engine_impl.cpp8
-rw-r--r--src/mongo/db/storage/storage_engine_test_fixture.h3
-rw-r--r--src/mongo/db/storage/storage_util.cpp5
4 files changed, 11 insertions, 6 deletions
diff --git a/src/mongo/db/storage/kv/durable_catalog_test.cpp b/src/mongo/db/storage/kv/durable_catalog_test.cpp
index bd49f858a33..5a29311d40b 100644
--- a/src/mongo/db/storage/kv/durable_catalog_test.cpp
+++ b/src/mongo/db/storage/kv/durable_catalog_test.cpp
@@ -119,6 +119,7 @@ public:
CollectionCatalog::write(operationContext(), [&](CollectionCatalog& catalog) {
catalog.registerCollection(operationContext(),
+ options.uuid.value(),
std::move(collection),
/*ts=*/boost::none);
});
diff --git a/src/mongo/db/storage/storage_engine_impl.cpp b/src/mongo/db/storage/storage_engine_impl.cpp
index fc567484812..4cfa38852c0 100644
--- a/src/mongo/db/storage/storage_engine_impl.cpp
+++ b/src/mongo/db/storage/storage_engine_impl.cpp
@@ -428,7 +428,8 @@ void StorageEngineImpl::_initCollection(OperationContext* opCtx,
auto collection = collectionFactory->make(opCtx, nss, catalogId, md, std::move(rs));
CollectionCatalog::write(opCtx, [&](CollectionCatalog& catalog) {
- catalog.registerCollection(opCtx, std::move(collection), /*commitTime*/ minValidTs);
+ catalog.registerCollection(
+ opCtx, md->options.uuid.value(), std::move(collection), /*commitTime*/ minValidTs);
});
}
@@ -1398,8 +1399,9 @@ int64_t StorageEngineImpl::sizeOnDiskForDb(OperationContext* opCtx, const Databa
if (opCtx->isLockFreeReadsOp()) {
auto collectionCatalog = CollectionCatalog::get(opCtx);
- for (auto&& coll : collectionCatalog->range(dbName)) {
- perCollectionWork(coll);
+ for (auto it = collectionCatalog->begin(opCtx, dbName); it != collectionCatalog->end(opCtx);
+ ++it) {
+ perCollectionWork(*it);
}
} else {
catalog::forEachCollectionFromDb(opCtx, dbName, MODE_IS, perCollectionWork);
diff --git a/src/mongo/db/storage/storage_engine_test_fixture.h b/src/mongo/db/storage/storage_engine_test_fixture.h
index 6e9c3ef8cce..d0a79882e9f 100644
--- a/src/mongo/db/storage/storage_engine_test_fixture.h
+++ b/src/mongo/db/storage/storage_engine_test_fixture.h
@@ -82,7 +82,8 @@ public:
std::move(rs));
CollectionCatalog::write(opCtx, [&](CollectionCatalog& catalog) {
- catalog.registerCollection(opCtx, std::move(coll), /*ts=*/boost::none);
+ catalog.registerCollection(
+ opCtx, options.uuid.get(), std::move(coll), /*ts=*/boost::none);
});
return {{_storageEngine->getCatalog()->getEntry(catalogId)}};
diff --git a/src/mongo/db/storage/storage_util.cpp b/src/mongo/db/storage/storage_util.cpp
index e7634b858c9..7339dde91f2 100644
--- a/src/mongo/db/storage/storage_util.cpp
+++ b/src/mongo/db/storage/storage_util.cpp
@@ -59,7 +59,8 @@ auto removeEmptyDirectory =
auto collectionCatalog = CollectionCatalog::latest(svcCtx);
const DatabaseName& dbName = ns.dbName();
if (!storageEngine->isUsingDirectoryPerDb() ||
- (storageEngine->supportsPendingDrops() && !collectionCatalog->range(dbName).empty())) {
+ (storageEngine->supportsPendingDrops() &&
+ collectionCatalog->begin(nullptr, dbName) != collectionCatalog->end(nullptr))) {
return;
}
@@ -68,7 +69,7 @@ auto removeEmptyDirectory =
if (!ec) {
LOGV2(4888200, "Removed empty database directory", logAttrs(dbName));
- } else if (collectionCatalog->range(dbName).empty()) {
+ } else if (collectionCatalog->begin(nullptr, dbName) == collectionCatalog->end(nullptr)) {
// It is possible for a new collection to be created in the database between when we
// check whether the database is empty and actually attempting to remove the directory.
// In this case, don't log that the removal failed because it is expected. However,