summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/rollback_impl.cpp
diff options
context:
space:
mode:
authorHenrik Edin <henrik.edin@mongodb.com>2020-11-03 12:42:38 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-11-13 20:15:34 +0000
commit8f9823f644d0b6beba8a301866141a578d278534 (patch)
tree1ef4bc439da93a2b39cff7c96a975668c27e7070 /src/mongo/db/repl/rollback_impl.cpp
parentb670258ac185ecea0492c742f2f50da9d8ab618f (diff)
downloadmongo-8f9823f644d0b6beba8a301866141a578d278534.tar.gz
SERVER-52556 Versioned CollectionCatalog. Writes are performed using copy-on-write.
Internal mutexes when reading CollectionCatalog are removed, just one mutex for writes are needed. Lock-free reads helper AutoGetCollectionForReadLockFree stashes a CollectionCatalog consistent with snapshot on OperationContext
Diffstat (limited to 'src/mongo/db/repl/rollback_impl.cpp')
-rw-r--r--src/mongo/db/repl/rollback_impl.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/mongo/db/repl/rollback_impl.cpp b/src/mongo/db/repl/rollback_impl.cpp
index f72cf0a33e6..9bb33c3168b 100644
--- a/src/mongo/db/repl/rollback_impl.cpp
+++ b/src/mongo/db/repl/rollback_impl.cpp
@@ -564,10 +564,10 @@ void RollbackImpl::_runPhaseFromAbortToReconstructPreparedTxns(
void RollbackImpl::_correctRecordStoreCounts(OperationContext* opCtx) {
// This function explicitly does not check for shutdown since a clean shutdown post oplog
// truncation is not allowed to occur until the record store counts are corrected.
- const auto& catalog = CollectionCatalog::get(opCtx);
+ auto catalog = CollectionCatalog::get(opCtx);
for (const auto& uiCount : _newCounts) {
const auto uuid = uiCount.first;
- const auto coll = catalog.lookupCollectionByUUID(opCtx, uuid);
+ const auto coll = catalog->lookupCollectionByUUID(opCtx, uuid);
invariant(coll,
str::stream() << "The collection with UUID " << uuid
<< " is unexpectedly missing in the CollectionCatalog");
@@ -665,7 +665,7 @@ void RollbackImpl::_correctRecordStoreCounts(OperationContext* opCtx) {
}
Status RollbackImpl::_findRecordStoreCounts(OperationContext* opCtx) {
- const auto& catalog = CollectionCatalog::get(opCtx);
+ auto catalog = CollectionCatalog::get(opCtx);
auto storageEngine = opCtx->getServiceContext()->getStorageEngine();
LOGV2(21604, "Finding record store counts");
@@ -676,7 +676,7 @@ Status RollbackImpl::_findRecordStoreCounts(OperationContext* opCtx) {
continue;
}
- auto nss = catalog.lookupNSSByUUID(opCtx, uuid);
+ auto nss = catalog->lookupNSSByUUID(opCtx, uuid);
StorageInterface::CollectionCount oldCount = 0;
// Drop-pending collections are not visible to rollback via the catalog when they are
@@ -1131,11 +1131,11 @@ boost::optional<BSONObj> RollbackImpl::_findDocumentById(OperationContext* opCtx
}
Status RollbackImpl::_writeRollbackFiles(OperationContext* opCtx) {
- const auto& catalog = CollectionCatalog::get(opCtx);
+ auto catalog = CollectionCatalog::get(opCtx);
auto storageEngine = opCtx->getServiceContext()->getStorageEngine();
for (auto&& entry : _observerInfo.rollbackDeletedIdsMap) {
const auto& uuid = entry.first;
- const auto nss = catalog.lookupNSSByUUID(opCtx, uuid);
+ const auto nss = catalog->lookupNSSByUUID(opCtx, uuid);
// Drop-pending collections are not visible to rollback via the catalog when they are
// managed by the storage engine. See StorageEngine::supportsPendingDrops().