summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorScott Hernandez <scotthernandez@gmail.com>2014-12-22 17:32:27 -0500
committerScott Hernandez <scotthernandez@gmail.com>2015-01-02 14:21:08 -0500
commit8384c878b542352ba88ecade1e675b8412f2655f (patch)
treea9b40ee6ec4fb837b99a2d3a9e37b6ece12a650c /src/mongo/dbtests
parent8b37507dd51cdf058377a24ca0171e7fae6f2c6b (diff)
downloadmongo-8384c878b542352ba88ecade1e675b8412f2655f.tar.gz
SERVER-16502: make getCollection const and not require an OpContext
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/counttests.cpp2
-rw-r--r--src/mongo/dbtests/dbhelper_tests.cpp2
-rw-r--r--src/mongo/dbtests/executor_registry.cpp4
-rw-r--r--src/mongo/dbtests/namespacetests.cpp28
-rw-r--r--src/mongo/dbtests/oplogstarttests.cpp4
-rw-r--r--src/mongo/dbtests/pdfiletests.cpp2
-rw-r--r--src/mongo/dbtests/query_plan_executor.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_count_scan.cpp2
-rw-r--r--src/mongo/dbtests/query_stage_fetch.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_keep.cpp4
-rw-r--r--src/mongo/dbtests/query_stage_merge_sort.cpp14
-rw-r--r--src/mongo/dbtests/query_stage_sort.cpp10
-rw-r--r--src/mongo/dbtests/query_stage_update.cpp2
-rw-r--r--src/mongo/dbtests/querytests.cpp9
-rw-r--r--src/mongo/dbtests/repltests.cpp14
-rw-r--r--src/mongo/dbtests/rollbacktests.cpp26
16 files changed, 65 insertions, 66 deletions
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp
index a854ebc0110..918b87ed3d7 100644
--- a/src/mongo/dbtests/counttests.cpp
+++ b/src/mongo/dbtests/counttests.cpp
@@ -54,7 +54,7 @@ namespace CountTests {
{
WriteUnitOfWork wunit(&_txn);
- _collection = _database->getCollection( &_txn, ns() );
+ _collection = _database->getCollection( ns() );
if ( _collection ) {
_database->dropCollection( &_txn, ns() );
}
diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp
index aa30a6fa749..ec695ece1d7 100644
--- a/src/mongo/dbtests/dbhelper_tests.cpp
+++ b/src/mongo/dbtests/dbhelper_tests.cpp
@@ -160,7 +160,7 @@ namespace mongo {
ASSERT_LESS_THAN( estSizeBytes, maxSizeBytes );
Database* db = dbHolder().get( &txn, nsToDatabase(range.ns) );
- const Collection* collection = db->getCollection(&txn, ns);
+ const Collection* collection = db->getCollection(ns);
// Make sure all the disklocs actually correspond to the right info
for ( set<RecordId>::const_iterator it = locs.begin(); it != locs.end(); ++it ) {
diff --git a/src/mongo/dbtests/executor_registry.cpp b/src/mongo/dbtests/executor_registry.cpp
index 183079bee08..c9581be2952 100644
--- a/src/mongo/dbtests/executor_registry.cpp
+++ b/src/mongo/dbtests/executor_registry.cpp
@@ -80,7 +80,7 @@ namespace ExecutorRegistry {
ws.release(),
scan.release(),
cq,
- _ctx->ctx().db()->getCollection(&_opCtx, ns()),
+ _ctx->ctx().db()->getCollection(ns()),
PlanExecutor::YIELD_MANUAL,
&exec);
ASSERT_OK(status);
@@ -106,7 +106,7 @@ namespace ExecutorRegistry {
int N() { return 50; }
Collection* collection() {
- return _ctx->ctx().db()->getCollection( &_opCtx, ns() );
+ return _ctx->ctx().db()->getCollection( ns() );
}
static const char* ns() { return "unittests.ExecutorRegistryDiskLocInvalidation"; }
diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp
index ca4171e22a0..eb6c604c264 100644
--- a/src/mongo/dbtests/namespacetests.cpp
+++ b/src/mongo/dbtests/namespacetests.cpp
@@ -536,28 +536,28 @@ namespace NamespaceTests {
Collection* committedColl;
{
WriteUnitOfWork wunit(&txn);
- ASSERT_FALSE(db->getCollection(&txn, committedName));
+ ASSERT_FALSE(db->getCollection(committedName));
committedColl = db->createCollection(&txn, committedName);
- ASSERT_EQUALS(db->getCollection(&txn, committedName), committedColl);
+ ASSERT_EQUALS(db->getCollection(committedName), committedColl);
wunit.commit();
}
- ASSERT_EQUALS(db->getCollection(&txn, committedName), committedColl);
+ ASSERT_EQUALS(db->getCollection(committedName), committedColl);
{
WriteUnitOfWork wunit(&txn);
- ASSERT_FALSE(db->getCollection(&txn, rolledBackName));
+ ASSERT_FALSE(db->getCollection(rolledBackName));
Collection* rolledBackColl = db->createCollection(&txn, rolledBackName);
- ASSERT_EQUALS(db->getCollection(&txn, rolledBackName), rolledBackColl);
+ ASSERT_EQUALS(db->getCollection(rolledBackName), rolledBackColl);
// not committing so creation should be rolled back
}
// The rolledBackCollection creation should have been rolled back
- ASSERT_FALSE(db->getCollection(&txn, rolledBackName));
+ ASSERT_FALSE(db->getCollection(rolledBackName));
// The committedCollection should not have been affected by the rollback. Holders
// of the original Collection pointer should still be valid.
- ASSERT_EQUALS(db->getCollection(&txn, committedName), committedColl);
+ ASSERT_EQUALS(db->getCollection(committedName), committedColl);
}
};
@@ -579,33 +579,33 @@ namespace NamespaceTests {
{
WriteUnitOfWork wunit(&txn);
- ASSERT_FALSE(db->getCollection(&txn, droppedName));
+ ASSERT_FALSE(db->getCollection(droppedName));
Collection* droppedColl;
droppedColl = db->createCollection(&txn, droppedName);
- ASSERT_EQUALS(db->getCollection(&txn, droppedName), droppedColl);
+ ASSERT_EQUALS(db->getCollection(droppedName), droppedColl);
db->dropCollection(&txn, droppedName);
wunit.commit();
}
// Should have been really dropped
- ASSERT_FALSE(db->getCollection(&txn, droppedName));
+ ASSERT_FALSE(db->getCollection(droppedName));
{
WriteUnitOfWork wunit(&txn);
- ASSERT_FALSE(db->getCollection(&txn, rolledBackName));
+ ASSERT_FALSE(db->getCollection(rolledBackName));
Collection* rolledBackColl = db->createCollection(&txn, rolledBackName);
wunit.commit();
- ASSERT_EQUALS(db->getCollection(&txn, rolledBackName), rolledBackColl);
+ ASSERT_EQUALS(db->getCollection(rolledBackName), rolledBackColl);
db->dropCollection(&txn, rolledBackName);
// not committing so dropping should be rolled back
}
// The rolledBackCollection dropping should have been rolled back.
// Original Collection pointers are no longer valid.
- ASSERT(db->getCollection(&txn, rolledBackName));
+ ASSERT(db->getCollection(rolledBackName));
// The droppedCollection should not have been restored by the rollback.
- ASSERT_FALSE(db->getCollection(&txn, droppedName));
+ ASSERT_FALSE(db->getCollection(droppedName));
}
};
} // namespace DatabaseTests
diff --git a/src/mongo/dbtests/oplogstarttests.cpp b/src/mongo/dbtests/oplogstarttests.cpp
index b84724ed853..1a6d397766f 100644
--- a/src/mongo/dbtests/oplogstarttests.cpp
+++ b/src/mongo/dbtests/oplogstarttests.cpp
@@ -44,7 +44,7 @@ namespace OplogStartTests {
_context(&_txn, ns()),
_client(&_txn) {
- Collection* c = _context.db()->getCollection(&_txn, ns());
+ Collection* c = _context.db()->getCollection(ns());
if (!c) {
c = _context.db()->createCollection(&_txn, ns());
}
@@ -71,7 +71,7 @@ namespace OplogStartTests {
}
Collection* collection() {
- return _context.db()->getCollection( &_txn, ns() );
+ return _context.db()->getCollection( ns() );
}
DBDirectClient* client() { return &_client; }
diff --git a/src/mongo/dbtests/pdfiletests.cpp b/src/mongo/dbtests/pdfiletests.cpp
index 9d2a0fb2078..fbf557e9f40 100644
--- a/src/mongo/dbtests/pdfiletests.cpp
+++ b/src/mongo/dbtests/pdfiletests.cpp
@@ -62,7 +62,7 @@ namespace PdfileTests {
return "unittests.pdfiletests.Insert";
}
Collection* collection() {
- return _context.db()->getCollection( &_txn, ns() );
+ return _context.db()->getCollection( ns() );
}
OperationContextImpl _txn;
diff --git a/src/mongo/dbtests/query_plan_executor.cpp b/src/mongo/dbtests/query_plan_executor.cpp
index dcb46f8705d..4b55d33262b 100644
--- a/src/mongo/dbtests/query_plan_executor.cpp
+++ b/src/mongo/dbtests/query_plan_executor.cpp
@@ -129,7 +129,7 @@ namespace QueryPlanExecutor {
ixparams.bounds.endKeyInclusive = true;
ixparams.direction = 1;
- const Collection* coll = context.db()->getCollection(&_txn, ns());
+ const Collection* coll = context.db()->getCollection(ns());
auto_ptr<WorkingSet> ws(new WorkingSet());
IndexScan* ix = new IndexScan(&_txn, ixparams, ws.get(), NULL);
@@ -180,7 +180,7 @@ namespace QueryPlanExecutor {
private:
IndexDescriptor* getIndex(Database* db, const BSONObj& obj) {
- Collection* collection = db->getCollection( &_txn, ns() );
+ Collection* collection = db->getCollection( ns() );
return collection->getIndexCatalog()->findIndexByKeyPattern(&_txn, obj);
}
diff --git a/src/mongo/dbtests/query_stage_count_scan.cpp b/src/mongo/dbtests/query_stage_count_scan.cpp
index 0301f391359..d3d379fc6fe 100644
--- a/src/mongo/dbtests/query_stage_count_scan.cpp
+++ b/src/mongo/dbtests/query_stage_count_scan.cpp
@@ -88,7 +88,7 @@ namespace QueryStageCountScan {
}
IndexDescriptor* getIndex(Database* db, const BSONObj& obj) {
- Collection* collection = db->getCollection(&_txn, ns());
+ Collection* collection = db->getCollection(ns());
return collection->getIndexCatalog()->findIndexByKeyPattern(&_txn, obj);
}
diff --git a/src/mongo/dbtests/query_stage_fetch.cpp b/src/mongo/dbtests/query_stage_fetch.cpp
index a827dafd570..cb13920cae6 100644
--- a/src/mongo/dbtests/query_stage_fetch.cpp
+++ b/src/mongo/dbtests/query_stage_fetch.cpp
@@ -89,7 +89,7 @@ namespace QueryStageFetch {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -151,7 +151,7 @@ namespace QueryStageFetch {
Lock::DBLock lk(_txn.lockState(), nsToDatabaseSubstring(ns()), MODE_X);
Client::Context ctx(&_txn, ns());
Database* db = ctx.db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
diff --git a/src/mongo/dbtests/query_stage_keep.cpp b/src/mongo/dbtests/query_stage_keep.cpp
index 40c49905102..9b7b6464c87 100644
--- a/src/mongo/dbtests/query_stage_keep.cpp
+++ b/src/mongo/dbtests/query_stage_keep.cpp
@@ -107,7 +107,7 @@ namespace QueryStageKeep {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -172,7 +172,7 @@ namespace QueryStageKeep {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
diff --git a/src/mongo/dbtests/query_stage_merge_sort.cpp b/src/mongo/dbtests/query_stage_merge_sort.cpp
index 53173b26780..a157ef635c6 100644
--- a/src/mongo/dbtests/query_stage_merge_sort.cpp
+++ b/src/mongo/dbtests/query_stage_merge_sort.cpp
@@ -111,7 +111,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -180,7 +180,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -248,7 +248,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -317,7 +317,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -387,7 +387,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -455,7 +455,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -513,7 +513,7 @@ namespace QueryStageMergeSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
diff --git a/src/mongo/dbtests/query_stage_sort.cpp b/src/mongo/dbtests/query_stage_sort.cpp
index 23a1b34fd30..d182a91e12f 100644
--- a/src/mongo/dbtests/query_stage_sort.cpp
+++ b/src/mongo/dbtests/query_stage_sort.cpp
@@ -190,7 +190,7 @@ namespace QueryStageSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -210,7 +210,7 @@ namespace QueryStageSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -239,7 +239,7 @@ namespace QueryStageSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -259,7 +259,7 @@ namespace QueryStageSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
@@ -351,7 +351,7 @@ namespace QueryStageSortTests {
void run() {
Client::WriteContext ctx(&_txn, ns());
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
if (!coll) {
WriteUnitOfWork wuow(&_txn);
coll = db->createCollection(&_txn, ns());
diff --git a/src/mongo/dbtests/query_stage_update.cpp b/src/mongo/dbtests/query_stage_update.cpp
index 624eec54a71..ac3472881e9 100644
--- a/src/mongo/dbtests/query_stage_update.cpp
+++ b/src/mongo/dbtests/query_stage_update.cpp
@@ -255,7 +255,7 @@ namespace QueryStageUpdate {
OpDebug* opDebug = &curOp.debug();
UpdateDriver driver( (UpdateDriver::Options()) );
Database* db = ctx.ctx().db();
- Collection* coll = db->getCollection(&_txn, ns());
+ Collection* coll = db->getCollection(ns());
// Get the RecordIds that would be returned by an in-order scan.
vector<RecordId> locs;
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 449a3d52b7d..657a0b03b52 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -62,7 +62,7 @@ namespace QueryTests {
{
WriteUnitOfWork wunit(&_txn);
_database = _context.db();
- _collection = _database->getCollection( &_txn, ns() );
+ _collection = _database->getCollection( ns() );
if ( _collection ) {
_database->dropCollection( &_txn, ns() );
}
@@ -177,7 +177,7 @@ namespace QueryTests {
{
WriteUnitOfWork wunit(&_txn);
Database* db = ctx.db();
- if ( db->getCollection( &_txn, ns() ) ) {
+ if ( db->getCollection( ns() ) ) {
_collection = NULL;
db->dropCollection( &_txn, ns() );
}
@@ -665,7 +665,7 @@ namespace QueryTests {
ASSERT_EQUALS( two, c->next()["ts"].Date() );
long long cursorId = c->getCursorId();
- ClientCursorPin clientCursor( ctx.db()->getCollection( &_txn, ns )->cursorManager(),
+ ClientCursorPin clientCursor( ctx.db()->getCollection( ns )->cursorManager(),
cursorId );
ASSERT_EQUALS( three.millis, clientCursor.c()->getSlaveReadTill().asDate() );
}
@@ -1553,8 +1553,7 @@ namespace QueryTests {
{
Client::WriteContext ctx(&_txn, ns() );
- ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( &_txn,
- ns())->cursorManager(),
+ ClientCursorPin pinCursor( ctx.ctx().db()->getCollection( ns())->cursorManager(),
cursorId );
string expectedAssertion =
str::stream() << "Cannot kill active cursor " << cursorId;
diff --git a/src/mongo/dbtests/repltests.cpp b/src/mongo/dbtests/repltests.cpp
index 29444c86544..6a3f50d5959 100644
--- a/src/mongo/dbtests/repltests.cpp
+++ b/src/mongo/dbtests/repltests.cpp
@@ -79,7 +79,7 @@ namespace ReplTests {
Client::WriteContext ctx(&_txn, ns());
WriteUnitOfWork wuow(&_txn);
- Collection* c = ctx.ctx().db()->getCollection(&_txn, ns());
+ Collection* c = ctx.ctx().db()->getCollection(ns());
if ( ! c ) {
c = ctx.ctx().db()->createCollection(&_txn, ns());
}
@@ -135,7 +135,7 @@ namespace ReplTests {
Lock::GlobalWrite lk(_txn.lockState());
Client::Context ctx(&_txn, ns() );
Database* db = ctx.db();
- Collection* coll = db->getCollection( &_txn, ns() );
+ Collection* coll = db->getCollection( ns() );
if ( !coll ) {
WriteUnitOfWork wunit(&_txn);
coll = db->createCollection( &_txn, ns() );
@@ -156,7 +156,7 @@ namespace ReplTests {
Client::Context ctx(&_txn, cllNS() );
Database* db = ctx.db();
- Collection* coll = db->getCollection( &_txn, cllNS() );
+ Collection* coll = db->getCollection( cllNS() );
if ( !coll ) {
WriteUnitOfWork wunit(&_txn);
coll = db->createCollection( &_txn, cllNS() );
@@ -178,7 +178,7 @@ namespace ReplTests {
{
Client::Context ctx(&_txn, cllNS() );
Database* db = ctx.db();
- Collection* coll = db->getCollection( &_txn, cllNS() );
+ Collection* coll = db->getCollection( cllNS() );
RecordIterator* it = coll->getIterator(&_txn);
while ( !it->isEOF() ) {
@@ -209,7 +209,7 @@ namespace ReplTests {
Client::Context ctx(&_txn, ns );
Database* db = ctx.db();
- Collection* coll = db->getCollection( &_txn, ns );
+ Collection* coll = db->getCollection( ns );
if ( !coll ) {
WriteUnitOfWork wunit(&_txn);
coll = db->createCollection( &_txn, ns );
@@ -231,7 +231,7 @@ namespace ReplTests {
Client::Context ctx(&_txn, ns );
WriteUnitOfWork wunit(&_txn);
Database* db = ctx.db();
- Collection* coll = db->getCollection( &_txn, ns );
+ Collection* coll = db->getCollection( ns );
if ( !coll ) {
coll = db->createCollection( &_txn, ns );
}
@@ -253,7 +253,7 @@ namespace ReplTests {
Client::Context ctx(&_txn, ns() );
WriteUnitOfWork wunit(&_txn);
Database* db = ctx.db();
- Collection* coll = db->getCollection( &_txn, ns() );
+ Collection* coll = db->getCollection( ns() );
if ( !coll ) {
coll = db->createCollection( &_txn, ns() );
}
diff --git a/src/mongo/dbtests/rollbacktests.cpp b/src/mongo/dbtests/rollbacktests.cpp
index 11771128e84..2f7645e7ed1 100644
--- a/src/mongo/dbtests/rollbacktests.cpp
+++ b/src/mongo/dbtests/rollbacktests.cpp
@@ -80,13 +80,13 @@ namespace {
return db->renameCollection( txn, source.ns(), target.ns(), false );
}
Status truncateCollection( OperationContext* txn, const NamespaceString& nss ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
return coll->truncate( txn );
}
RecordId insertRecord( OperationContext* txn,
const NamespaceString& nss,
const BSONObj& data ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
StatusWith<RecordId> status = coll->insertDocument( txn, data, false );
ASSERT_OK( status.getStatus() );
return status.getValue();
@@ -94,7 +94,7 @@ namespace {
void assertOnlyRecord( OperationContext* txn,
const NamespaceString& nss,
const BSONObj& data ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
scoped_ptr<RecordIterator> iter( coll->getIterator( txn ) );
ASSERT( !iter->isEOF() );
RecordId loc = iter->getNext();
@@ -102,16 +102,16 @@ namespace {
ASSERT_EQ( data, coll->docFor( txn, loc ) );
}
void assertEmpty( OperationContext* txn, const NamespaceString& nss ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
scoped_ptr<RecordIterator> iter( coll->getIterator( txn ) );
ASSERT( iter->isEOF() );
}
bool indexExists( OperationContext* txn, const NamespaceString& nss, const string& idxName ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
return coll->getIndexCatalog()->findIndexByName( txn, idxName, true ) != NULL;
}
bool indexReady( OperationContext* txn, const NamespaceString& nss, const string& idxName ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
return coll->getIndexCatalog()->findIndexByName( txn, idxName, false ) != NULL;
}
size_t getNumIndexEntries( OperationContext* txn,
@@ -119,7 +119,7 @@ namespace {
const string& idxName ) {
size_t numEntries = 0;
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
IndexCatalog* catalog = coll->getIndexCatalog();
IndexDescriptor* desc = catalog->findIndexByName( txn, idxName, false );
@@ -141,7 +141,7 @@ namespace {
return numEntries;
}
void dropIndex( OperationContext* txn, const NamespaceString& nss, const string& idxName ) {
- Collection* coll = dbHolder().get( txn, nss.db() )->getCollection( txn, nss.ns() );
+ Collection* coll = dbHolder().get( txn, nss.db() )->getCollection(nss.ns() );
IndexDescriptor* desc = coll->getIndexCatalog()->findIndexByName( txn, idxName );
ASSERT( desc );
ASSERT_OK( coll->getIndexCatalog()->dropIndex( txn, desc ) );
@@ -479,7 +479,7 @@ namespace {
ScopedTransaction transaction(&txn, MODE_IX);
AutoGetDb autoDb(&txn, nss.db(), MODE_X);
- Collection* coll = autoDb.getDb()->getCollection( &txn, ns );
+ Collection* coll = autoDb.getDb()->getCollection( ns );
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -520,7 +520,7 @@ namespace {
ScopedTransaction transaction(&txn, MODE_IX);
AutoGetDb autoDb(&txn, nss.db(), MODE_X);
- Collection* coll = autoDb.getDb()->getCollection(&txn, ns);
+ Collection* coll = autoDb.getDb()->getCollection(ns);
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -573,7 +573,7 @@ namespace {
ScopedTransaction transaction(&txn, MODE_IX);
AutoGetDb autoDb(&txn, nss.db(), MODE_X);
- Collection* coll = autoDb.getDb()->getCollection(&txn, ns);
+ Collection* coll = autoDb.getDb()->getCollection(ns);
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -616,7 +616,7 @@ namespace {
ScopedTransaction transaction(&txn, MODE_IX);
AutoGetDb autoDb(&txn, nss.db(), MODE_X);
- Collection* coll = autoDb.getDb()->getCollection(&txn, ns);
+ Collection* coll = autoDb.getDb()->getCollection(ns);
IndexCatalog* catalog = coll->getIndexCatalog();
string idxName = "a";
@@ -693,7 +693,7 @@ namespace {
ASSERT( !collectionExists( &ctx, nss.ns() ) );
ASSERT_OK( userCreateNS( &txn, ctx.db(), nss.ns(), BSONObj(), false, false ) );
ASSERT( collectionExists( &ctx, nss.ns() ) );
- Collection* coll = ctx.db()->getCollection( &txn, ns );
+ Collection* coll = ctx.db()->getCollection( ns );
IndexCatalog* catalog = coll->getIndexCatalog();
ASSERT_OK( catalog->createIndexOnEmptyCollection( &txn, specA ) );