summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/clienttests.cpp4
-rw-r--r--src/mongo/dbtests/counttests.cpp3
-rw-r--r--src/mongo/dbtests/dbtests.cpp4
-rw-r--r--src/mongo/dbtests/dbtests.h2
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp3
-rw-r--r--src/mongo/dbtests/multikey_paths_test.cpp18
-rw-r--r--src/mongo/dbtests/pdfiletests.cpp4
-rw-r--r--src/mongo/dbtests/plan_executor_invalidation_test.cpp3
-rw-r--r--src/mongo/dbtests/query_plan_executor.cpp16
-rw-r--r--src/mongo/dbtests/query_stage_and.cpp42
-rw-r--r--src/mongo/dbtests/query_stage_cached_plan.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_collscan.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_delete.cpp6
-rw-r--r--src/mongo/dbtests/query_stage_fetch.cpp6
-rw-r--r--src/mongo/dbtests/query_stage_merge_sort.cpp24
-rw-r--r--src/mongo/dbtests/query_stage_sort.cpp20
-rw-r--r--src/mongo/dbtests/query_stage_subplan.cpp14
-rw-r--r--src/mongo/dbtests/query_stage_update.cpp8
-rw-r--r--src/mongo/dbtests/querytests.cpp3
-rw-r--r--src/mongo/dbtests/repltests.cpp10
-rw-r--r--src/mongo/dbtests/rollbacktests.cpp20
-rw-r--r--src/mongo/dbtests/storage_timestamp_tests.cpp66
-rw-r--r--src/mongo/dbtests/validate_tests.cpp76
-rw-r--r--src/mongo/dbtests/wildcard_multikey_persistence_test.cpp25
24 files changed, 203 insertions, 182 deletions
diff --git a/src/mongo/dbtests/clienttests.cpp b/src/mongo/dbtests/clienttests.cpp
index b007e2956ca..a8a42782b20 100644
--- a/src/mongo/dbtests/clienttests.cpp
+++ b/src/mongo/dbtests/clienttests.cpp
@@ -119,9 +119,9 @@ public:
db.insert(ns(), BSON("x" << 1 << "y" << 2));
db.insert(ns(), BSON("x" << 2 << "y" << 2));
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
ASSERT(collection);
- IndexCatalog* indexCatalog = collection->getIndexCatalog();
+ const IndexCatalog* indexCatalog = collection->getIndexCatalog();
const bool includeBuildUUIDs = false;
const int options = 0;
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp
index 0506f843572..28734e0d9eb 100644
--- a/src/mongo/dbtests/counttests.cpp
+++ b/src/mongo/dbtests/counttests.cpp
@@ -52,7 +52,8 @@ public:
WriteUnitOfWork wunit(&_opCtx);
_collection =
- CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
+ CollectionCatalog::get(&_opCtx).lookupCollectionByNamespaceForMetadataWrite(&_opCtx,
+ nss());
if (_collection) {
_database->dropCollection(&_opCtx, nss()).transitional_ignore();
}
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index 0ecc021f82d..67e1d45833e 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -105,8 +105,8 @@ Status createIndexFromSpec(OperationContext* opCtx, StringData ns, const BSONObj
Collection* coll;
{
WriteUnitOfWork wunit(opCtx);
- coll =
- CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, NamespaceString(ns));
+ coll = CollectionCatalog::get(opCtx).lookupCollectionByNamespaceForMetadataWrite(
+ opCtx, NamespaceString(ns));
if (!coll) {
coll = autoDb.getDb()->createCollection(opCtx, NamespaceString(ns));
}
diff --git a/src/mongo/dbtests/dbtests.h b/src/mongo/dbtests/dbtests.h
index 617a4f64520..8a1e7065573 100644
--- a/src/mongo/dbtests/dbtests.h
+++ b/src/mongo/dbtests/dbtests.h
@@ -79,7 +79,7 @@ public:
return _clientContext->db();
}
- Collection* getCollection() const {
+ const Collection* getCollection() const {
return CollectionCatalog::get(_opCtx).lookupCollectionByNamespace(_opCtx, _nss);
}
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index dc6f23cc99f..9ee7c081b1d 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -81,7 +81,8 @@ public:
}
Collection* collection() {
- return CollectionCatalog::get(_opCtx).lookupCollectionByNamespace(_opCtx, _nss);
+ return CollectionCatalog::get(_opCtx).lookupCollectionByNamespaceForMetadataWrite(_opCtx,
+ _nss);
}
protected:
diff --git a/src/mongo/dbtests/multikey_paths_test.cpp b/src/mongo/dbtests/multikey_paths_test.cpp
index 5fcffe14b1d..0342a4049af 100644
--- a/src/mongo/dbtests/multikey_paths_test.cpp
+++ b/src/mongo/dbtests/multikey_paths_test.cpp
@@ -77,14 +77,14 @@ public:
}
}
- Status createIndex(Collection* collection, BSONObj indexSpec) {
+ Status createIndex(const Collection* collection, BSONObj indexSpec) {
return dbtests::createIndexFromSpec(_opCtx.get(), collection->ns().ns(), indexSpec);
}
- void assertMultikeyPaths(Collection* collection,
+ void assertMultikeyPaths(const Collection* collection,
BSONObj keyPattern,
const MultikeyPaths& expectedMultikeyPaths) {
- IndexCatalog* indexCatalog = collection->getIndexCatalog();
+ const IndexCatalog* indexCatalog = collection->getIndexCatalog();
std::vector<const IndexDescriptor*> indexes;
indexCatalog->findIndexesByKeyPattern(_opCtx.get(), keyPattern, false, &indexes);
ASSERT_EQ(indexes.size(), 1U);
@@ -125,7 +125,7 @@ private:
TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) {
AutoGetCollection autoColl(_opCtx.get(), _nss, MODE_X);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
invariant(collection);
{
@@ -150,7 +150,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreation) {
TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreationWithMultipleDocuments) {
AutoGetCollection autoColl(_opCtx.get(), _nss, MODE_X);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
invariant(collection);
{
@@ -179,7 +179,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnIndexCreationWithMultipleDocuments) {
TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) {
AutoGetCollection autoColl(_opCtx.get(), _nss, MODE_X);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
invariant(collection);
BSONObj keyPattern = BSON("a" << 1 << "b" << 1);
@@ -216,7 +216,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentInsert) {
TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentUpdate) {
AutoGetCollection autoColl(_opCtx.get(), _nss, MODE_X);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
invariant(collection);
BSONObj keyPattern = BSON("a" << 1 << "b" << 1);
@@ -264,7 +264,7 @@ TEST_F(MultikeyPathsTest, PathsUpdatedOnDocumentUpdate) {
TEST_F(MultikeyPathsTest, PathsNotUpdatedOnDocumentDelete) {
AutoGetCollection autoColl(_opCtx.get(), _nss, MODE_X);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
invariant(collection);
BSONObj keyPattern = BSON("a" << 1 << "b" << 1);
@@ -304,7 +304,7 @@ TEST_F(MultikeyPathsTest, PathsNotUpdatedOnDocumentDelete) {
TEST_F(MultikeyPathsTest, PathsUpdatedForMultipleIndexesOnDocumentInsert) {
AutoGetCollection autoColl(_opCtx.get(), _nss, MODE_X);
- Collection* collection = autoColl.getCollection();
+ const Collection* collection = autoColl.getCollection();
invariant(collection);
BSONObj keyPatternAB = BSON("a" << 1 << "b" << 1);
diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp
index ac55a11f63b..2352931aa9e 100644
--- a/src/mongo/dbtests/pdfiletests.cpp
+++ b/src/mongo/dbtests/pdfiletests.cpp
@@ -59,7 +59,7 @@ protected:
static NamespaceString nss() {
return NamespaceString("unittests.pdfiletests.Insert");
}
- Collection* collection() {
+ const Collection* collection() {
return CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
}
@@ -75,7 +75,7 @@ public:
WriteUnitOfWork wunit(&_opCtx);
BSONObj x = BSON("x" << 1);
ASSERT(x["_id"].type() == 0);
- Collection* coll =
+ const Collection* coll =
CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
if (!coll) {
coll = _context.db()->createCollection(&_opCtx, nss());
diff --git a/src/mongo/dbtests/plan_executor_invalidation_test.cpp b/src/mongo/dbtests/plan_executor_invalidation_test.cpp
index 8ff34319036..7b65c5cc1b3 100644
--- a/src/mongo/dbtests/plan_executor_invalidation_test.cpp
+++ b/src/mongo/dbtests/plan_executor_invalidation_test.cpp
@@ -118,7 +118,8 @@ public:
}
Collection* collection() {
- return CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss);
+ return CollectionCatalog::get(&_opCtx).lookupCollectionByNamespaceForMetadataWrite(&_opCtx,
+ nss);
}
void truncateCollection(Collection* collection) const {
diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp
index 075ededc8e9..d0bc883c9d5 100644
--- a/src/mongo/dbtests/query_plan_executor.cpp
+++ b/src/mongo/dbtests/query_plan_executor.cpp
@@ -97,7 +97,7 @@ public:
* capable of executing a simple collection scan.
*/
unique_ptr<PlanExecutor, PlanExecutor::Deleter> makeCollScanExec(
- Collection* coll,
+ const Collection* coll,
BSONObj& filterObj,
PlanYieldPolicy::YieldPolicy yieldPolicy = PlanYieldPolicy::YieldPolicy::YIELD_MANUAL,
TailableModeEnum tailableMode = TailableModeEnum::kNormal) {
@@ -183,7 +183,7 @@ protected:
private:
const IndexDescriptor* getIndex(Database* db, const BSONObj& obj) {
- Collection* collection =
+ const Collection* collection =
CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss);
std::vector<const IndexDescriptor*> indexes;
collection->getIndexCatalog()->findIndexesByKeyPattern(&_opCtx, obj, false, &indexes);
@@ -206,7 +206,7 @@ TEST_F(PlanExecutorTest, DropIndexScanAgg) {
BSONObj indexSpec = BSON("a" << 1);
addIndex(indexSpec);
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
// Create the aggregation pipeline.
std::vector<BSONObj> rawPipeline = {fromjson("{$match: {a: {$gte: 7, $lte: 10}}}")};
@@ -242,7 +242,7 @@ TEST_F(PlanExecutorTest, ShouldReportErrorIfExceedsTimeLimitDuringYield) {
BSONObj filterObj = fromjson("{_id: {$gt: 0}}");
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
auto exec = makeCollScanExec(coll, filterObj, PlanYieldPolicy::YieldPolicy::ALWAYS_TIME_OUT);
BSONObj resultObj;
@@ -259,7 +259,7 @@ TEST_F(PlanExecutorTest, ShouldReportErrorIfKilledDuringYieldButIsTailableAndAwa
BSONObj filterObj = fromjson("{_id: {$gt: 0}}");
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
auto exec = makeCollScanExec(coll,
filterObj,
PlanYieldPolicy::YieldPolicy::ALWAYS_TIME_OUT,
@@ -279,7 +279,7 @@ TEST_F(PlanExecutorTest, ShouldNotSwallowExceedsTimeLimitDuringYieldButIsTailabl
BSONObj filterObj = fromjson("{_id: {$gt: 0}}");
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
auto exec = makeCollScanExec(coll,
filterObj,
PlanYieldPolicy::YieldPolicy::ALWAYS_TIME_OUT,
@@ -299,7 +299,7 @@ TEST_F(PlanExecutorTest, ShouldReportErrorIfKilledDuringYield) {
BSONObj filterObj = fromjson("{_id: {$gt: 0}}");
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
auto exec = makeCollScanExec(coll, filterObj, PlanYieldPolicy::YieldPolicy::ALWAYS_MARK_KILLED);
BSONObj resultObj;
@@ -364,7 +364,7 @@ TEST_F(PlanExecutorSnapshotTest, SnapshotControl) {
BSONObj filterObj = fromjson("{a: {$gte: 2}}");
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
auto exec = makeCollScanExec(coll, filterObj);
BSONObj objOut;
diff --git a/src/mongo/dbtests/query_stage_and.cpp b/src/mongo/dbtests/query_stage_and.cpp
index 96dac1ea2e5..d08909af1ce 100644
--- a/src/mongo/dbtests/query_stage_and.cpp
+++ b/src/mongo/dbtests/query_stage_and.cpp
@@ -73,7 +73,7 @@ public:
ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), obj));
}
- const IndexDescriptor* getIndex(const BSONObj& obj, Collection* coll) {
+ const IndexDescriptor* getIndex(const BSONObj& obj, const Collection* coll) {
std::vector<const IndexDescriptor*> indexes;
coll->getIndexCatalog()->findIndexesByKeyPattern(&_opCtx, obj, false, &indexes);
if (indexes.empty()) {
@@ -92,7 +92,7 @@ public:
return params;
}
- 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);
@@ -178,7 +178,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -264,7 +264,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -345,7 +345,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -389,7 +389,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -437,7 +437,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -483,7 +483,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -536,7 +536,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -589,7 +589,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -645,7 +645,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -693,7 +693,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -746,7 +746,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -796,7 +796,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -918,7 +918,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -1026,7 +1026,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -1080,7 +1080,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -1119,7 +1119,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -1162,7 +1162,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -1223,7 +1223,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
@@ -1276,7 +1276,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
coll = db->createCollection(&_opCtx, nss());
diff --git a/src/mongo/dbtests/query_stage_cached_plan.cpp b/src/mongo/dbtests/query_stage_cached_plan.cpp
index cf38ceadda4..cc62d39971b 100644
--- a/src/mongo/dbtests/query_stage_cached_plan.cpp
+++ b/src/mongo/dbtests/query_stage_cached_plan.cpp
@@ -81,7 +81,7 @@ public:
addIndex(BSON("b" << 1));
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
ASSERT(collection);
// Add data.
@@ -111,7 +111,7 @@ public:
wuow.commit();
}
- void insertDocument(Collection* collection, BSONObj obj) {
+ void insertDocument(const Collection* collection, BSONObj obj) {
WriteUnitOfWork wuow(&_opCtx);
OpDebug* const nullOpDebug = nullptr;
diff --git a/src/mongo/dbtests/query_stage_collscan.cpp b/src/mongo/dbtests/query_stage_collscan.cpp
index 275f13f5158..e765f7473a7 100644
--- a/src/mongo/dbtests/query_stage_collscan.cpp
+++ b/src/mongo/dbtests/query_stage_collscan.cpp
@@ -247,7 +247,7 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanObjectsInOrderBackward) {
TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObject) {
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
// Get the RecordIds that would be returned by an in-order scan.
vector<RecordId> recordIds;
@@ -300,7 +300,7 @@ TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObject) {
// object we would have gotten after that. But, do it in reverse!
TEST_F(QueryStageCollectionScanTest, QueryStageCollscanDeleteUpcomingObjectBackward) {
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
// Get the RecordIds that would be returned by an in-order scan.
vector<RecordId> recordIds;
diff --git a/src/mongo/dbtests/query_stage_delete.cpp b/src/mongo/dbtests/query_stage_delete.cpp
index 6ff9419dd17..b362e23516f 100644
--- a/src/mongo/dbtests/query_stage_delete.cpp
+++ b/src/mongo/dbtests/query_stage_delete.cpp
@@ -81,7 +81,7 @@ public:
_client.remove(nss.ns(), obj);
}
- void getRecordIds(Collection* collection,
+ void getRecordIds(const Collection* collection,
CollectionScanParams::Direction direction,
vector<RecordId>* out) {
WorkingSet ws;
@@ -133,7 +133,7 @@ public:
void run() {
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
ASSERT(coll);
// Get the RecordIds that would be returned by an in-order scan.
@@ -194,7 +194,7 @@ public:
void run() {
// Various variables we'll need.
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
ASSERT(coll);
const int targetDocIndex = 0;
const BSONObj query = BSON("foo" << BSON("$gte" << targetDocIndex));
diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp
index 163621ce89e..4d040923e34 100644
--- a/src/mongo/dbtests/query_stage_fetch.cpp
+++ b/src/mongo/dbtests/query_stage_fetch.cpp
@@ -62,7 +62,7 @@ public:
_client.dropCollection(ns());
}
- 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);
@@ -102,7 +102,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);
@@ -169,7 +169,7 @@ public:
Lock::DBLock lk(&_opCtx, nss().db(), MODE_X);
OldClientContext ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll =
+ const Collection* coll =
CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
if (!coll) {
WriteUnitOfWork wuow(&_opCtx);
diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp
index f645dc88d07..2e386c1b114 100644
--- a/src/mongo/dbtests/query_stage_merge_sort.cpp
+++ b/src/mongo/dbtests/query_stage_merge_sort.cpp
@@ -72,7 +72,7 @@ public:
ASSERT_OK(dbtests::createIndex(&_opCtx, ns(), obj));
}
- const IndexDescriptor* getIndex(const BSONObj& obj, Collection* coll) {
+ const IndexDescriptor* getIndex(const BSONObj& obj, const Collection* coll) {
std::vector<const IndexDescriptor*> indexes;
coll->getIndexCatalog()->findIndexesByKeyPattern(&_opCtx, obj, false, &indexes);
return indexes.empty() ? nullptr : indexes[0];
@@ -101,7 +101,7 @@ public:
_client.update(ns(), predicate, update);
}
- 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);
@@ -148,7 +148,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);
@@ -218,7 +218,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);
@@ -287,7 +287,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);
@@ -357,7 +357,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);
@@ -431,7 +431,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);
@@ -499,7 +499,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);
@@ -557,7 +557,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);
@@ -677,7 +677,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);
@@ -780,7 +780,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);
@@ -852,7 +852,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);
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);
diff --git a/src/mongo/dbtests/query_stage_subplan.cpp b/src/mongo/dbtests/query_stage_subplan.cpp
index 8d56d4e094d..51c00d629b8 100644
--- a/src/mongo/dbtests/query_stage_subplan.cpp
+++ b/src/mongo/dbtests/query_stage_subplan.cpp
@@ -139,7 +139,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanGeo2dOr) {
ASSERT_OK(statusWithCQ.getStatus());
std::unique_ptr<CanonicalQuery> cq = std::move(statusWithCQ.getValue());
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
// Get planner params.
QueryPlannerParams plannerParams;
@@ -168,7 +168,7 @@ void assertSubplanFromCache(QueryStageSubplanTest* test, const dbtests::WriteCon
test->insert(BSON("a" << 1 << "b" << i << "c" << i));
}
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
auto qr = std::make_unique<QueryRequest>(nss);
qr->setFilter(query);
@@ -252,7 +252,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanDontCacheZeroResults) {
// one relevant index.
BSONObj query = fromjson("{$or: [{a: 1, b: 15}, {c: 1}]}");
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
auto qr = std::make_unique<QueryRequest>(nss);
qr->setFilter(query);
@@ -308,7 +308,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanDontCacheTies) {
// ranking. For the second branch it's because there is only one relevant index.
BSONObj query = fromjson("{$or: [{a: 1, e: 1}, {d: 1}]}");
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
auto qr = std::make_unique<QueryRequest>(nss);
qr->setFilter(query);
@@ -487,7 +487,7 @@ TEST_F(QueryStageSubplanTest, QueryStageSubplanPlanRootedOrNE) {
qr->setSort(BSON("d" << 1));
auto cq = unittest::assertGet(CanonicalQuery::canonicalize(opCtx(), std::move(qr)));
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
QueryPlannerParams plannerParams;
fillOutPlannerParams(opCtx(), collection, cq.get(), &plannerParams);
@@ -571,7 +571,7 @@ TEST_F(QueryStageSubplanTest, ShouldReportErrorIfKilledDuringPlanning) {
}
TEST_F(QueryStageSubplanTest, ShouldThrowOnRestoreIfIndexDroppedBeforePlanSelection) {
- Collection* collection = nullptr;
+ const Collection* collection = nullptr;
{
dbtests::WriteContextForTests ctx{opCtx(), nss.ns()};
addIndex(BSON("p1" << 1 << "opt1" << 1));
@@ -615,7 +615,7 @@ TEST_F(QueryStageSubplanTest, ShouldThrowOnRestoreIfIndexDroppedBeforePlanSelect
}
TEST_F(QueryStageSubplanTest, ShouldNotThrowOnRestoreIfIndexDroppedAfterPlanSelection) {
- Collection* collection = nullptr;
+ const Collection* collection = nullptr;
{
dbtests::WriteContextForTests ctx{opCtx(), nss.ns()};
addIndex(BSON("p1" << 1 << "opt1" << 1));
diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp
index e1e01a3d008..439531d9ff9 100644
--- a/src/mongo/dbtests/query_stage_update.cpp
+++ b/src/mongo/dbtests/query_stage_update.cpp
@@ -204,7 +204,7 @@ public:
CurOp& curOp = *CurOp::get(_opCtx);
OpDebug* opDebug = &curOp.debug();
UpdateDriver driver(_expCtx);
- Collection* collection = ctx.getCollection();
+ const Collection* collection = ctx.getCollection();
ASSERT(collection);
// Collection should be empty.
@@ -276,7 +276,7 @@ public:
CurOp& curOp = *CurOp::get(_opCtx);
OpDebug* opDebug = &curOp.debug();
UpdateDriver driver(_expCtx);
- Collection* coll =
+ const Collection* coll =
CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss);
ASSERT(coll);
@@ -388,7 +388,7 @@ public:
// Various variables we'll need.
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
OpDebug* opDebug = &CurOp::get(_opCtx)->debug();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
ASSERT(coll);
auto request = UpdateRequest();
request.setNamespaceString(nss);
@@ -481,7 +481,7 @@ public:
// Various variables we'll need.
dbtests::WriteContextForTests ctx(&_opCtx, nss.ns());
OpDebug* opDebug = &CurOp::get(_opCtx)->debug();
- Collection* coll = ctx.getCollection();
+ const Collection* coll = ctx.getCollection();
ASSERT(coll);
auto request = UpdateRequest();
request.setNamespaceString(nss);
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index fbda40e576a..84d533e2069 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -69,7 +69,8 @@ public:
WriteUnitOfWork wunit(&_opCtx);
_database = _context.db();
_collection =
- CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
+ CollectionCatalog::get(&_opCtx).lookupCollectionByNamespaceForMetadataWrite(&_opCtx,
+ nss());
if (_collection) {
_database->dropCollection(&_opCtx, nss()).transitional_ignore();
}
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index a9cd656c0e9..e35d43f9a42 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -128,7 +128,8 @@ public:
dbtests::WriteContextForTests ctx(&_opCtx, ns());
WriteUnitOfWork wuow(&_opCtx);
- Collection* c = CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
+ const Collection* c =
+ CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
if (!c) {
c = ctx.db()->createCollection(&_opCtx, nss());
}
@@ -200,7 +201,7 @@ protected:
Lock::GlobalWrite lk(&_opCtx);
OldClientContext ctx(&_opCtx, ns());
Database* db = ctx.db();
- Collection* coll =
+ const Collection* coll =
CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
if (!coll) {
WriteUnitOfWork wunit(&_opCtx);
@@ -259,7 +260,8 @@ protected:
WriteUnitOfWork wunit(&_opCtx);
Database* db = ctx.db();
Collection* coll =
- CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss);
+ CollectionCatalog::get(&_opCtx).lookupCollectionByNamespaceForMetadataWrite(&_opCtx,
+ nss);
if (!coll) {
coll = db->createCollection(&_opCtx, nss);
}
@@ -273,7 +275,7 @@ protected:
OldClientContext ctx(&_opCtx, ns());
WriteUnitOfWork wunit(&_opCtx);
Database* db = ctx.db();
- Collection* coll =
+ const Collection* coll =
CollectionCatalog::get(&_opCtx).lookupCollectionByNamespace(&_opCtx, nss());
if (!coll) {
coll = db->createCollection(&_opCtx, nss());
diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp
index ebd8ce2e5cb..1b86b7a319b 100644
--- a/src/mongo/dbtests/rollbacktests.cpp
+++ b/src/mongo/dbtests/rollbacktests.cpp
@@ -84,7 +84,8 @@ Status renameCollection(OperationContext* opCtx,
return renameCollection(opCtx, source, target, {});
}
Status truncateCollection(OperationContext* opCtx, const NamespaceString& nss) {
- auto coll = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, nss);
+ auto coll =
+ CollectionCatalog::get(opCtx).lookupCollectionByNamespaceForMetadataWrite(opCtx, nss);
return coll->truncate(opCtx);
}
@@ -121,7 +122,7 @@ size_t getNumIndexEntries(OperationContext* opCtx,
size_t numEntries = 0;
auto coll = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, nss);
- IndexCatalog* catalog = coll->getIndexCatalog();
+ const IndexCatalog* catalog = coll->getIndexCatalog();
auto desc = catalog->findIndexByName(opCtx, idxName, false);
if (desc) {
@@ -142,7 +143,8 @@ size_t getNumIndexEntries(OperationContext* opCtx,
}
void dropIndex(OperationContext* opCtx, const NamespaceString& nss, const string& idxName) {
- auto coll = CollectionCatalog::get(opCtx).lookupCollectionByNamespace(opCtx, nss);
+ auto coll =
+ CollectionCatalog::get(opCtx).lookupCollectionByNamespaceForMetadataWrite(opCtx, nss);
auto desc = coll->getIndexCatalog()->findIndexByName(opCtx, idxName);
ASSERT(desc);
ASSERT_OK(coll->getIndexCatalog()->dropIndex(opCtx, desc));
@@ -485,7 +487,8 @@ public:
AutoGetDb autoDb(&opCtx, nss.db(), MODE_X);
- Collection* coll = CollectionCatalog::get(&opCtx).lookupCollectionByNamespace(&opCtx, nss);
+ Collection* coll =
+ CollectionCatalog::get(&opCtx).lookupCollectionByNamespaceForMetadataWrite(&opCtx, nss);
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -526,7 +529,8 @@ public:
AutoGetDb autoDb(&opCtx, nss.db(), MODE_X);
- Collection* coll = CollectionCatalog::get(&opCtx).lookupCollectionByNamespace(&opCtx, nss);
+ Collection* coll =
+ CollectionCatalog::get(&opCtx).lookupCollectionByNamespaceForMetadataWrite(&opCtx, nss);
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -579,7 +583,8 @@ public:
AutoGetDb autoDb(&opCtx, nss.db(), MODE_X);
- Collection* coll = CollectionCatalog::get(&opCtx).lookupCollectionByNamespace(&opCtx, nss);
+ Collection* coll =
+ CollectionCatalog::get(&opCtx).lookupCollectionByNamespaceForMetadataWrite(&opCtx, nss);
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -643,7 +648,8 @@ public:
ASSERT_OK(ctx.db()->userCreateNS(&opCtx, nss, collectionOptions, false));
ASSERT(collectionExists(&opCtx, &ctx, nss.ns()));
Collection* coll =
- CollectionCatalog::get(&opCtx).lookupCollectionByNamespace(&opCtx, nss);
+ CollectionCatalog::get(&opCtx).lookupCollectionByNamespaceForMetadataWrite(&opCtx,
+ nss);
IndexCatalog* catalog = coll->getIndexCatalog();
ASSERT_OK(catalog->createIndexOnEmptyCollection(&opCtx, specA));
diff --git a/src/mongo/dbtests/storage_timestamp_tests.cpp b/src/mongo/dbtests/storage_timestamp_tests.cpp
index 32656e03b7d..750c8ac447d 100644
--- a/src/mongo/dbtests/storage_timestamp_tests.cpp
+++ b/src/mongo/dbtests/storage_timestamp_tests.cpp
@@ -237,13 +237,13 @@ public:
_opCtx->recoveryUnit()->setTimestampReadSource(RecoveryUnit::ReadSource::kUnset);
AutoGetCollection collRaii(_opCtx, nss, LockMode::MODE_X);
- if (collRaii.getCollection()) {
+ if (collRaii) {
WriteUnitOfWork wunit(_opCtx);
- invariant(collRaii.getCollection()->truncate(_opCtx).isOK());
+ invariant(collRaii.getWritableCollection()->truncate(_opCtx).isOK());
if (_opCtx->recoveryUnit()->getCommitTimestamp().isNull()) {
ASSERT_OK(_opCtx->recoveryUnit()->setTimestamp(Timestamp(1, 1)));
}
- collRaii.getCollection()->getIndexCatalog()->dropAllIndexes(_opCtx, false);
+ collRaii.getWritableCollection()->getIndexCatalog()->dropAllIndexes(_opCtx, false);
wunit.commit();
return;
}
@@ -258,7 +258,7 @@ public:
});
}
- void insertDocument(Collection* coll, const InsertStatement& stmt) {
+ void insertDocument(const Collection* coll, const InsertStatement& stmt) {
// Insert some documents.
OpDebug* const nullOpDebug = nullptr;
const bool fromMigrate = false;
@@ -383,7 +383,7 @@ public:
const Timestamp& ts,
const repl::MinValidDocument& expectedDoc) {
AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_IX);
- Collection* coll = autoColl.getCollection();
+ const Collection* coll = autoColl.getCollection();
OneOffRead oor(_opCtx, ts);
@@ -667,7 +667,7 @@ public:
}
void assertMultikeyPaths(OperationContext* opCtx,
- Collection* collection,
+ const Collection* collection,
StringData indexName,
Timestamp ts,
bool shouldBeMultikey,
@@ -1891,7 +1891,7 @@ public:
MultiIndexBlock indexer;
auto abortOnExit = makeGuard([&] {
indexer.abortIndexBuild(
- _opCtx, autoColl.getCollection(), MultiIndexBlock::kNoopOnCleanUpFn);
+ _opCtx, autoColl.getWritableCollection(), MultiIndexBlock::kNoopOnCleanUpFn);
});
const LogicalTime beforeIndexBuild = _clock->tickClusterTime(2);
BSONObj indexInfoObj;
@@ -1910,7 +1910,7 @@ public:
auto swIndexInfoObj = indexer.init(
_opCtx,
- autoColl.getCollection(),
+ autoColl.getWritableCollection(),
{BSON("v" << 2 << "unique" << true << "name"
<< "a_1"
<< "key" << BSON("a" << 1))},
@@ -1933,7 +1933,7 @@ public:
// timestamp.
ASSERT_OK(indexer.commit(
_opCtx,
- autoColl.getCollection(),
+ autoColl.getWritableCollection(),
[&](const BSONObj& indexSpec) {
if (SimulatePrimary) {
// The timestamping responsibility for each index is placed on the caller.
@@ -2005,7 +2005,7 @@ public:
MultiIndexBlock indexer;
auto abortOnExit = makeGuard([&] {
indexer.abortIndexBuild(
- _opCtx, autoColl.getCollection(), MultiIndexBlock::kNoopOnCleanUpFn);
+ _opCtx, autoColl.getWritableCollection(), MultiIndexBlock::kNoopOnCleanUpFn);
});
const LogicalTime beforeIndexBuild = _clock->tickClusterTime(2);
BSONObj indexInfoObj;
@@ -2024,7 +2024,7 @@ public:
auto swIndexInfoObj = indexer.init(
_opCtx,
- autoColl.getCollection(),
+ autoColl.getWritableCollection(),
{BSON("v" << 2 << "unique" << true << "name"
<< "a_1"
<< "ns" << nss.ns() << "key" << BSON("a" << 1))},
@@ -2516,7 +2516,8 @@ public:
std::vector<std::string> indexIdents;
// Create an index and get the ident for each index.
for (auto key : {"a", "b", "c"}) {
- createIndex(autoColl.getCollection(), str::stream() << key << "_1", BSON(key << 1));
+ createIndex(
+ autoColl.getWritableCollection(), str::stream() << key << "_1", BSON(key << 1));
// Timestamps at the completion of each index build.
afterCreateTimestamps.push_back(_clock->tickClusterTime(1).asTimestamp());
@@ -2595,7 +2596,8 @@ public:
std::vector<std::string> indexIdents;
// Create an index and get the ident for each index.
for (auto key : {"a", "b", "c"}) {
- createIndex(autoColl.getCollection(), str::stream() << key << "_1", BSON(key << 1));
+ createIndex(
+ autoColl.getWritableCollection(), str::stream() << key << "_1", BSON(key << 1));
// Timestamps at the completion of each index build.
afterCreateTimestamps.push_back(_clock->tickClusterTime(1).asTimestamp());
@@ -2719,8 +2721,7 @@ public:
NamespaceString nss("unittests.timestampIndexBuilds");
reset(nss);
- AutoGetCollection autoColl(_opCtx, nss, LockMode::MODE_X);
- auto collection = autoColl.getCollection();
+ AutoGetCollection collection(_opCtx, nss, LockMode::MODE_X);
// Indexing of parallel arrays is not allowed, so these are deemed "bad".
const auto badDoc1 =
@@ -2735,7 +2736,7 @@ public:
{
LOGV2(22505, "inserting {badDoc1}", "badDoc1"_attr = badDoc1);
WriteUnitOfWork wuow(_opCtx);
- insertDocument(autoColl.getCollection(),
+ insertDocument(collection.getCollection(),
InsertStatement(badDoc1, insert1.asTimestamp(), presentTerm));
wuow.commit();
}
@@ -2744,7 +2745,7 @@ public:
{
LOGV2(22506, "inserting {badDoc2}", "badDoc2"_attr = badDoc2);
WriteUnitOfWork wuow(_opCtx);
- insertDocument(autoColl.getCollection(),
+ insertDocument(collection.getCollection(),
InsertStatement(badDoc2, insert2.asTimestamp(), presentTerm));
wuow.commit();
}
@@ -2752,7 +2753,8 @@ public:
const IndexCatalogEntry* buildingIndex = nullptr;
MultiIndexBlock indexer;
auto abortOnExit = makeGuard([&] {
- indexer.abortIndexBuild(_opCtx, collection, MultiIndexBlock::kNoopOnCleanUpFn);
+ indexer.abortIndexBuild(
+ _opCtx, collection.getWritableCollection(), MultiIndexBlock::kNoopOnCleanUpFn);
});
// Provide a build UUID, indicating that this is a two-phase index build.
@@ -2770,14 +2772,14 @@ public:
{
TimestampBlock tsBlock(_opCtx, indexInit.asTimestamp());
- auto swSpecs =
- indexer.init(_opCtx,
- collection,
- {BSON("v" << 2 << "name"
- << "a_1_b_1"
- << "ns" << collection->ns().ns() << "key"
- << BSON("a" << 1 << "b" << 1))},
- MultiIndexBlock::makeTimestampedIndexOnInitFn(_opCtx, collection));
+ auto swSpecs = indexer.init(_opCtx,
+ collection.getWritableCollection(),
+ {BSON("v" << 2 << "name"
+ << "a_1_b_1"
+ << "ns" << collection->ns().ns() << "key"
+ << BSON("a" << 1 << "b" << 1))},
+ MultiIndexBlock::makeTimestampedIndexOnInitFn(
+ _opCtx, collection.getCollection()));
ASSERT_OK(swSpecs.getStatus());
}
@@ -2786,7 +2788,7 @@ public:
indexCatalog->findIndexByName(_opCtx, "a_1_b_1", /* includeUnfinished */ true));
ASSERT(buildingIndex);
- ASSERT_OK(indexer.insertAllDocumentsInCollection(_opCtx, collection));
+ ASSERT_OK(indexer.insertAllDocumentsInCollection(_opCtx, collection.getCollection()));
ASSERT_TRUE(buildingIndex->indexBuildInterceptor()->areAllWritesApplied(_opCtx));
@@ -2820,7 +2822,7 @@ public:
buildingIndex->indexBuildInterceptor()->getSkippedRecordTracker()->areAllRecordsApplied(
_opCtx));
// This fails because the bad record is still invalid.
- auto status = indexer.retrySkippedRecords(_opCtx, collection);
+ auto status = indexer.retrySkippedRecords(_opCtx, collection.getCollection());
ASSERT_EQ(status.code(), ErrorCodes::CannotIndexParallelArrays);
ASSERT_FALSE(
@@ -2832,8 +2834,8 @@ public:
// to the side writes table and must be drained.
Helpers::upsert(_opCtx, collection->ns().ns(), BSON("_id" << 0 << "a" << 1 << "b" << 1));
{
- RecordId badRecord =
- Helpers::findOne(_opCtx, collection, BSON("_id" << 1), false /* requireIndex */);
+ RecordId badRecord = Helpers::findOne(
+ _opCtx, collection.getCollection(), BSON("_id" << 1), false /* requireIndex */);
WriteUnitOfWork wuow(_opCtx);
collection->deleteDocument(_opCtx, kUninitializedStmtId, badRecord, nullptr);
wuow.commit();
@@ -2846,7 +2848,7 @@ public:
// This succeeds because the bad documents are now either valid or removed.
- ASSERT_OK(indexer.retrySkippedRecords(_opCtx, collection));
+ ASSERT_OK(indexer.retrySkippedRecords(_opCtx, collection.getCollection()));
ASSERT_TRUE(
buildingIndex->indexBuildInterceptor()->getSkippedRecordTracker()->areAllRecordsApplied(
_opCtx));
@@ -2857,7 +2859,7 @@ public:
WriteUnitOfWork wuow(_opCtx);
ASSERT_OK(indexer.commit(
_opCtx,
- collection,
+ collection.getWritableCollection(),
[&](const BSONObj& indexSpec) {
_opCtx->getServiceContext()->getOpObserver()->onCreateIndex(
_opCtx, collection->ns(), collection->uuid(), indexSpec, false);
diff --git a/src/mongo/dbtests/validate_tests.cpp b/src/mongo/dbtests/validate_tests.cpp
index be56190e176..df29527f5f7 100644
--- a/src/mongo/dbtests/validate_tests.cpp
+++ b/src/mongo/dbtests/validate_tests.cpp
@@ -194,7 +194,7 @@ public:
// Create a new collection, insert records {_id: 1} and {_id: 2} and check it's valid.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
OpDebug* const nullOpDebug = nullptr;
@@ -256,7 +256,7 @@ public:
// Create a new collection, insert two documents.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
OpDebug* const nullOpDebug = nullptr;
@@ -328,7 +328,7 @@ public:
// Create a new collection, insert three records.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -391,7 +391,7 @@ public:
// Create a new collection, insert records {_id: 1} and {_id: 2} and check it's valid.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -471,7 +471,7 @@ public:
// Create a new collection, insert three records and check it's valid.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
// {a: [b: 1, c: 2]}, {a: [b: 2, c: 2]}, {a: [b: 1, c: 1]}
auto doc1 = BSON("_id" << 1 << "a" << BSON_ARRAY(BSON("b" << 1) << BSON("c" << 2)));
@@ -557,7 +557,7 @@ public:
// Create a new collection, insert three records and check it's valid.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -621,7 +621,7 @@ public:
// Create a new collection, insert three records and check it's valid.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -692,7 +692,7 @@ public:
// field.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -754,7 +754,7 @@ public:
// Create a new collection, insert five records and check it's valid.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -839,7 +839,7 @@ public:
// Create a new collection, insert three records and check it's valid.
lockDb(MODE_X);
OpDebug* const nullOpDebug = nullptr;
- Collection* coll;
+ const Collection* coll;
RecordId id1;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -870,7 +870,7 @@ public:
lockDb(MODE_X);
// Replace a correct index entry with a bad one and check it's invalid.
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -927,7 +927,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -987,7 +987,7 @@ public:
// Insert additional multikey path metadata index keys.
lockDb(MODE_X);
const RecordId recordId(RecordId::ReservedId::kWildcardMultikeyMetadataId);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto accessMethod =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -1050,7 +1050,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1106,7 +1106,7 @@ public:
ensureValidateWorked();
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto accessMethod =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -1148,7 +1148,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1244,7 +1244,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1285,7 +1285,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -1361,7 +1361,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1448,7 +1448,7 @@ public:
void run() {
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1629,7 +1629,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1670,7 +1670,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -1807,7 +1807,7 @@ public:
void run() {
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -1962,7 +1962,7 @@ public:
// Create a new collection and insert a document.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
OpDebug* const nullOpDebug = nullptr;
{
WriteUnitOfWork wunit(&_opCtx);
@@ -2001,7 +2001,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
InsertDeleteOptions options;
options.logIfError = true;
@@ -2180,7 +2180,7 @@ public:
// Create a new collection and insert non-multikey document.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
RecordId id1;
BSONObj doc = BSON("_id" << 1 << "a" << 1);
{
@@ -2209,7 +2209,7 @@ public:
// Set up a non-multikey index with multikey document.
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -2358,7 +2358,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -2410,7 +2410,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
const std::string indexName = "a";
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
@@ -2447,7 +2447,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
const std::string indexName = "b";
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
@@ -2505,7 +2505,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -2551,7 +2551,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
InsertDeleteOptions options;
options.logIfError = true;
@@ -2708,7 +2708,7 @@ public:
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -2772,7 +2772,7 @@ public:
void run() {
// Create a new collection.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
{
WriteUnitOfWork wunit(&_opCtx);
ASSERT_OK(_db->dropCollection(&_opCtx, _nss));
@@ -2942,7 +2942,7 @@ public:
// Create a new collection and insert non-multikey document.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
RecordId id1;
BSONObj doc = BSON("_id" << 1 << "a" << 1);
{
@@ -2971,7 +2971,7 @@ public:
// Set up a non-multikey index with multikey document.
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
@@ -3164,7 +3164,7 @@ public:
// Create a new collection and insert multikey document.
lockDb(MODE_X);
- Collection* coll;
+ const Collection* coll;
RecordId id1;
BSONObj doc1 = BSON("_id" << 1 << "a" << BSON_ARRAY(1 << 2) << "b" << 1);
{
@@ -3195,7 +3195,7 @@ public:
{
lockDb(MODE_X);
- IndexCatalog* indexCatalog = coll->getIndexCatalog();
+ const IndexCatalog* indexCatalog = coll->getIndexCatalog();
auto descriptor = indexCatalog->findIndexByName(&_opCtx, indexName);
auto iam =
const_cast<IndexAccessMethod*>(indexCatalog->getEntry(descriptor)->accessMethod());
diff --git a/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp b/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp
index f611a733d6c..5e4a2d4c706 100644
--- a/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp
+++ b/src/mongo/dbtests/wildcard_multikey_persistence_test.cpp
@@ -200,22 +200,29 @@ protected:
auto indexSpec = (bob << "v" << kIndexVersion << "background" << background).obj();
Lock::DBLock dbLock(opCtx(), nss.db(), MODE_X);
- AutoGetCollection autoColl(opCtx(), nss, MODE_X);
- auto coll = autoColl.getCollection();
+ AutoGetCollection coll(opCtx(), nss, MODE_X);
MultiIndexBlock indexer;
- auto abortOnExit = makeGuard(
- [&] { indexer.abortIndexBuild(opCtx(), coll, MultiIndexBlock::kNoopOnCleanUpFn); });
+ auto abortOnExit = makeGuard([&] {
+ indexer.abortIndexBuild(
+ opCtx(), coll.getWritableCollection(), MultiIndexBlock::kNoopOnCleanUpFn);
+ });
// Initialize the index builder and add all documents currently in the collection.
- ASSERT_OK(
- indexer.init(opCtx(), coll, indexSpec, MultiIndexBlock::kNoopOnInitFn).getStatus());
- ASSERT_OK(indexer.insertAllDocumentsInCollection(opCtx(), coll));
+ ASSERT_OK(indexer
+ .init(opCtx(),
+ coll.getWritableCollection(),
+ indexSpec,
+ MultiIndexBlock::kNoopOnInitFn)
+ .getStatus());
+ ASSERT_OK(indexer.insertAllDocumentsInCollection(opCtx(), coll.getCollection()));
ASSERT_OK(indexer.checkConstraints(opCtx()));
WriteUnitOfWork wunit(opCtx());
- ASSERT_OK(indexer.commit(
- opCtx(), coll, MultiIndexBlock::kNoopOnCreateEachFn, MultiIndexBlock::kNoopOnCommitFn));
+ ASSERT_OK(indexer.commit(opCtx(),
+ coll.getWritableCollection(),
+ MultiIndexBlock::kNoopOnCreateEachFn,
+ MultiIndexBlock::kNoopOnCommitFn));
abortOnExit.dismiss();
wunit.commit();
}