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/dbtests/query_stage_sort.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/dbtests/query_stage_sort.cpp')
-rw-r--r-- | src/mongo/dbtests/query_stage_sort.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp index bf3353d698b..6b09933f62a 100644 --- a/src/mongo/dbtests/query_stage_sort.cpp +++ b/src/mongo/dbtests/query_stage_sort.cpp @@ -76,7 +76,7 @@ public: _client.insert(ns(), obj); } - void getRecordIds(set<RecordId>* out, Collection* coll) { + void getRecordIds(set<RecordId>* out, const Collection* coll) { auto cursor = coll->getCursor(&_opCtx); while (auto record = cursor->next()) { out->insert(record->id); @@ -86,7 +86,7 @@ public: /** * We feed a mix of (key, unowned, owned) data to the sort stage. */ - void insertVarietyOfObjects(WorkingSet* ws, QueuedDataStage* ms, Collection* coll) { + void insertVarietyOfObjects(WorkingSet* ws, QueuedDataStage* ms, const Collection* coll) { set<RecordId> recordIds; getRecordIds(&recordIds, coll); @@ -111,7 +111,7 @@ public: * which is owned by the caller. */ unique_ptr<PlanExecutor, PlanExecutor::Deleter> makePlanExecutorWithSortStage( - Collection* coll) { + const Collection* coll) { // Build the mock scan stage which feeds the data. auto ws = std::make_unique<WorkingSet>(); _workingSet = ws.get(); @@ -152,7 +152,7 @@ public: * If extAllowed is true, sorting will use use external sorting if available. * If limit is not zero, we limit the output of the sort stage to 'limit' results. */ - void sortAndCheck(int direction, Collection* coll) { + void sortAndCheck(int direction, const Collection* coll) { auto ws = std::make_unique<WorkingSet>(); auto queuedDataStage = std::make_unique<QueuedDataStage>(_expCtx.get(), ws.get()); @@ -259,7 +259,7 @@ public: void run() { dbtests::WriteContextForTests ctx(&_opCtx, ns()); Database* db = ctx.db(); - Collection* coll = + const Collection* coll = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss()); if (!coll) { WriteUnitOfWork wuow(&_opCtx); @@ -282,7 +282,7 @@ public: void run() { dbtests::WriteContextForTests ctx(&_opCtx, ns()); Database* db = ctx.db(); - Collection* coll = + const Collection* coll = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss()); if (!coll) { WriteUnitOfWork wuow(&_opCtx); @@ -314,7 +314,7 @@ public: void run() { dbtests::WriteContextForTests ctx(&_opCtx, ns()); Database* db = ctx.db(); - Collection* coll = + const Collection* coll = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss()); if (!coll) { WriteUnitOfWork wuow(&_opCtx); @@ -340,7 +340,7 @@ public: void run() { dbtests::WriteContextForTests ctx(&_opCtx, ns()); Database* db = ctx.db(); - Collection* coll = + const Collection* coll = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss()); if (!coll) { WriteUnitOfWork wuow(&_opCtx); @@ -455,7 +455,7 @@ public: void run() { dbtests::WriteContextForTests ctx(&_opCtx, ns()); Database* db = ctx.db(); - Collection* coll = + const Collection* coll = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss()); if (!coll) { WriteUnitOfWork wuow(&_opCtx); @@ -559,7 +559,7 @@ public: void run() { dbtests::WriteContextForTests ctx(&_opCtx, ns()); Database* db = ctx.db(); - Collection* coll = + const Collection* coll = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss()); if (!coll) { WriteUnitOfWork wuow(&_opCtx); |