diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-09-10 15:54:11 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-10-08 16:00:54 +0000 |
commit | 9be7d417381013546abb1cb8fd3886d572bf9b22 (patch) | |
tree | c740c61bb23d6af932db433ab84d32561c15a621 /src/mongo/db/system_index.cpp | |
parent | b20673ac9203d6178708fa36808ea9274742ef9f (diff) | |
download | mongo-9be7d417381013546abb1cb8fd3886d572bf9b22.tar.gz |
SERVER-50145 Collection instances are modified using copy-on-write
When a writable collection is requested from the catalog a cloned instance will be returned.
Its lifetime is managed by default in a WriteUnitOfWork and committed into the catalog in a commit handler.
In the case of a rollback the cloned and modified collection instance is simply discarded.
This removes the need to setup rollback handlers to restore any state written to a collection in the case of a rollback.
Diffstat (limited to 'src/mongo/db/system_index.cpp')
-rw-r--r-- | src/mongo/db/system_index.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/system_index.cpp b/src/mongo/db/system_index.cpp index 09521feda5a..6f3ad2a4410 100644 --- a/src/mongo/db/system_index.cpp +++ b/src/mongo/db/system_index.cpp @@ -199,7 +199,7 @@ Status verifySystemIndexes(OperationContext* opCtx) { return Status::OK(); } -void createSystemIndexes(OperationContext* opCtx, const CollectionPtr& collection) { +void createSystemIndexes(OperationContext* opCtx, CollectionWriter& collection) { invariant(collection); const NamespaceString& ns = collection->ns(); BSONObj indexSpec; @@ -219,7 +219,7 @@ void createSystemIndexes(OperationContext* opCtx, const CollectionPtr& collectio auto fromMigrate = false; try { IndexBuildsCoordinator::get(opCtx)->createIndexesOnEmptyCollection( - opCtx, collection->uuid(), {indexSpec}, fromMigrate); + opCtx, collection, {indexSpec}, fromMigrate); } catch (DBException& ex) { fassertFailedWithStatus(40456, ex.toStatus()); } |