diff options
author | Shin Yee Tan <shinyee.tan@mongodb.com> | 2022-06-10 15:33:45 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-06-10 16:22:12 +0000 |
commit | d94f6725598eac9b617bd5b1d383254f174b089a (patch) | |
tree | 481475c6bde274498486ab971ec1db316ecd2493 /src/mongo/db/catalog_raii.cpp | |
parent | 3337f39b423aa94d0f3617b66232a0526a19ec83 (diff) | |
download | mongo-d94f6725598eac9b617bd5b1d383254f174b089a.tar.gz |
SERVER-62370 Remove the _opCtx from the CollectionWriter and instead use the passed in opCtx
Diffstat (limited to 'src/mongo/db/catalog_raii.cpp')
-rw-r--r-- | src/mongo/db/catalog_raii.cpp | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/src/mongo/db/catalog_raii.cpp b/src/mongo/db/catalog_raii.cpp index 4396bf245fb..00106047492 100644 --- a/src/mongo/db/catalog_raii.cpp +++ b/src/mongo/db/catalog_raii.cpp @@ -478,7 +478,6 @@ struct CollectionWriter::SharedImpl { CollectionWriter::CollectionWriter(OperationContext* opCtx, const UUID& uuid) : _collection(&_storedCollection), - _opCtx(opCtx), _managed(true), _sharedImpl(std::make_shared<SharedImpl>(this)) { @@ -490,7 +489,6 @@ CollectionWriter::CollectionWriter(OperationContext* opCtx, const UUID& uuid) CollectionWriter::CollectionWriter(OperationContext* opCtx, const NamespaceString& nss) : _collection(&_storedCollection), - _opCtx(opCtx), _managed(true), _sharedImpl(std::make_shared<SharedImpl>(this)) { _storedCollection = CollectionCatalog::get(opCtx)->lookupCollectionByNamespace(opCtx, nss); @@ -502,7 +500,6 @@ CollectionWriter::CollectionWriter(OperationContext* opCtx, const NamespaceStrin CollectionWriter::CollectionWriter(OperationContext* opCtx, AutoGetCollection& autoCollection) : _collection(&autoCollection.getCollection()), - _opCtx(opCtx), _managed(true), _sharedImpl(std::make_shared<SharedImpl>(this)) { _sharedImpl->_writableCollectionInitializer = [&autoCollection, opCtx]() { @@ -523,7 +520,7 @@ CollectionWriter::~CollectionWriter() { } } -Collection* CollectionWriter::getWritableCollection() { +Collection* CollectionWriter::getWritableCollection(OperationContext* opCtx) { // Acquire writable instance lazily if not already available if (!_writableCollection) { _writableCollection = _sharedImpl->_writableCollectionInitializer(); @@ -539,7 +536,7 @@ Collection* CollectionWriter::getWritableCollection() { // and re-clone the Collection if a new write unit of work is opened. Holds the back // pointer to the CollectionWriter explicitly so we can detect if the instance is // already destroyed. - _opCtx->recoveryUnit()->registerChange( + opCtx->recoveryUnit()->registerChange( [shared = _sharedImpl](boost::optional<Timestamp>) { if (shared->_parent) shared->_parent->_writableCollection = nullptr; |