diff options
author | Henrik Edin <henrik.edin@mongodb.com> | 2020-08-14 10:23:04 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-09-02 23:53:39 +0000 |
commit | bf5914a20b596ba3bde772b42e579e028f733bac (patch) | |
tree | 2b26469571786d9adb5e95c47990c2416bfab9c4 /src/mongo/db/index_build_entry_helpers.cpp | |
parent | 6b3e341703b781bb1ff7b1263406a0f1d28dd77c (diff) | |
download | mongo-bf5914a20b596ba3bde772b42e579e028f733bac.tar.gz |
SERVER-50317 Const correct uses of Collection
Most of the code should only need a const Collection now. AutoGetCollection returns a const Collection by default. There is a placeholder getWritableCollection() interface that will handle the necessary steps we need for lock free reads in the future.
Added some operators to AutoGetCollection so it behaves more like a smart pointer.
Diffstat (limited to 'src/mongo/db/index_build_entry_helpers.cpp')
-rw-r--r-- | src/mongo/db/index_build_entry_helpers.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/mongo/db/index_build_entry_helpers.cpp b/src/mongo/db/index_build_entry_helpers.cpp index f537d445003..da3f43b29e2 100644 --- a/src/mongo/db/index_build_entry_helpers.cpp +++ b/src/mongo/db/index_build_entry_helpers.cpp @@ -62,7 +62,7 @@ Status upsert(OperationContext* opCtx, const IndexBuildEntry& indexBuildEntry) { [&]() -> Status { AutoGetCollection autoCollection( opCtx, NamespaceString::kIndexBuildEntryNamespace, MODE_IX); - Collection* collection = autoCollection.getCollection(); + const Collection* collection = autoCollection.getCollection(); if (!collection) { str::stream ss; ss << "Collection not found: " @@ -118,7 +118,7 @@ Status upsert(OperationContext* opCtx, const BSONObj& filter, const BSONObj& upd [&]() -> Status { AutoGetCollection autoCollection( opCtx, NamespaceString::kIndexBuildEntryNamespace, MODE_IX); - Collection* collection = autoCollection.getCollection(); + const Collection* collection = autoCollection.getCollection(); if (!collection) { str::stream ss; ss << "Collection not found: " @@ -158,7 +158,7 @@ void ensureIndexBuildEntriesNamespaceExists(OperationContext* opCtx) { opCtx, NamespaceString::kIndexBuildEntryNamespace)) { WriteUnitOfWork wuow(opCtx); CollectionOptions defaultCollectionOptions; - Collection* collection = + const Collection* collection = db->createCollection(opCtx, NamespaceString::kIndexBuildEntryNamespace, defaultCollectionOptions); @@ -195,7 +195,7 @@ Status addIndexBuildEntry(OperationContext* opCtx, const IndexBuildEntry& indexB [&]() -> Status { AutoGetCollection autoCollection( opCtx, NamespaceString::kIndexBuildEntryNamespace, MODE_IX); - Collection* collection = autoCollection.getCollection(); + const Collection* collection = autoCollection.getCollection(); if (!collection) { str::stream ss; ss << "Collection not found: " << NamespaceString::kIndexBuildEntryNamespace.ns(); @@ -229,7 +229,7 @@ Status removeIndexBuildEntry(OperationContext* opCtx, UUID indexBuildUUID) { [&]() -> Status { AutoGetCollection autoCollection( opCtx, NamespaceString::kIndexBuildEntryNamespace, MODE_IX); - Collection* collection = autoCollection.getCollection(); + const Collection* collection = autoCollection.getCollection(); if (!collection) { str::stream ss; ss << "Collection not found: " << NamespaceString::kIndexBuildEntryNamespace.ns(); |