diff options
author | Rishab Joshi <rishab.joshi@mongodb.com> | 2022-07-08 11:10:33 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-07-08 11:48:27 +0000 |
commit | 04b55aa4c74a1ebf5e1ef50294f06e0b91acc45a (patch) | |
tree | 4d83a91a5c56ca1fc82239f261a731f77f57c523 /src/mongo/db/catalog_raii.cpp | |
parent | 92a93d167d0a8ab1c584bfc496cda3371419aa3b (diff) | |
download | mongo-04b55aa4c74a1ebf5e1ef50294f06e0b91acc45a.tar.gz |
SERVER-66634 Make changes to the startup recovery and initial-sync for the change collections.
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index c3c87a95844..e3ae1132263 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -572,17 +572,19 @@ AutoGetChangeCollection::AutoGetChangeCollection(OperationContext* opCtx, AutoGetChangeCollection::AccessMode mode, boost::optional<TenantId> tenantId, Date_t deadline) { - auto nss = NamespaceString::makeChangeCollectionNSS(tenantId); - if (mode == AccessMode::kWrite) { + if (mode == AccessMode::kWriteInOplogContext) { // The global lock must already be held. invariant(opCtx->lockState()->isWriteLocked()); - - // TODO SERVER-66715 avoid taking 'AutoGetCollection' and remove - // 'AllowLockAcquisitionOnTimestampedUnitOfWork'. - AllowLockAcquisitionOnTimestampedUnitOfWork allowLockAcquisition(opCtx->lockState()); - _coll.emplace( - opCtx, nss, LockMode::MODE_IX, AutoGetCollectionViewMode::kViewsForbidden, deadline); } + + // TODO SERVER-66715 avoid taking 'AutoGetCollection' and remove + // 'AllowLockAcquisitionOnTimestampedUnitOfWork'. + AllowLockAcquisitionOnTimestampedUnitOfWork allowLockAcquisition(opCtx->lockState()); + _coll.emplace(opCtx, + NamespaceString::makeChangeCollectionNSS(tenantId), + LockMode::MODE_IX, + AutoGetCollectionViewMode::kViewsForbidden, + deadline); } const Collection* AutoGetChangeCollection::operator->() const { |