summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2014-09-29 17:53:20 -0400
committerGeert Bosch <geert@mongodb.com>2014-09-29 17:54:36 -0400
commit8e83e72512fcb8eb8f06987927766c0b77cea23e (patch)
tree21167749db25a7124a528157f20d1f7a3be4beee /src/mongo/dbtests
parent57af98451c500c5d8112cfc5e75917a0e561069f (diff)
downloadmongo-8e83e72512fcb8eb8f06987927766c0b77cea23e.tar.gz
BF-532: Revert "SERVER-14668: Replace uses of DBWrite lock with DBLock"
This reverts commit ae333bc94a7d89d3220dcae9579fcaf68aa2e290. This reverts commit 962f959a09b63aa0482d7e0c9bad89363d1e1194.
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/counttests.cpp5
-rw-r--r--src/mongo/dbtests/dbhelper_tests.cpp2
-rw-r--r--src/mongo/dbtests/namespacetests.cpp4
-rw-r--r--src/mongo/dbtests/querytests.cpp8
-rw-r--r--src/mongo/dbtests/threadedtests.cpp8
5 files changed, 13 insertions, 14 deletions
diff --git a/src/mongo/dbtests/counttests.cpp b/src/mongo/dbtests/counttests.cpp
index fff985c5666..71cb99539d0 100644
--- a/src/mongo/dbtests/counttests.cpp
+++ b/src/mongo/dbtests/counttests.cpp
@@ -43,8 +43,7 @@ namespace CountTests {
class Base {
public:
- Base() : lk(_txn.lockState(), nsToDatabaseSubstring(ns()), newlm::MODE_X),
- _wunit(&_txn), _context(&_txn, ns()) {
+ Base() : lk(_txn.lockState(), ns()), _wunit(&_txn), _context(&_txn, ns()) {
_database = _context.db();
_collection = _database->getCollection( &_txn, ns() );
if ( _collection ) {
@@ -97,7 +96,7 @@ namespace CountTests {
OperationContextImpl _txn;
private:
- Lock::DBLock lk;
+ Lock::DBWrite lk;
WriteUnitOfWork _wunit;
Client::Context _context;
diff --git a/src/mongo/dbtests/dbhelper_tests.cpp b/src/mongo/dbtests/dbhelper_tests.cpp
index 70ab52c878c..4801b711a1c 100644
--- a/src/mongo/dbtests/dbhelper_tests.cpp
+++ b/src/mongo/dbtests/dbhelper_tests.cpp
@@ -62,7 +62,7 @@ namespace mongo {
{
// Remove _id range [_min, _max).
- Lock::DBLock lk(txn.lockState(), nsToDatabaseSubstring(ns), newlm::MODE_X);
+ Lock::DBWrite lk(txn.lockState(), ns);
WriteUnitOfWork wunit(&txn);
Client::Context ctx(&txn, ns );
diff --git a/src/mongo/dbtests/namespacetests.cpp b/src/mongo/dbtests/namespacetests.cpp
index aa6d7828629..72a27859efa 100644
--- a/src/mongo/dbtests/namespacetests.cpp
+++ b/src/mongo/dbtests/namespacetests.cpp
@@ -524,7 +524,7 @@ namespace NamespaceTests {
OperationContextImpl txn;
- Lock::DBLock lk(txn.lockState(), dbName, newlm::MODE_X);
+ Lock::DBWrite lk(txn.lockState(), dbName);
bool justCreated;
Database* db = dbHolder().getOrCreate(&txn, dbName, justCreated);
@@ -567,7 +567,7 @@ namespace NamespaceTests {
OperationContextImpl txn;
- Lock::DBLock lk(txn.lockState(), dbName, newlm::MODE_X);
+ Lock::DBWrite lk(txn.lockState(), dbName);
bool justCreated;
Database* db = dbHolder().getOrCreate(&txn, dbName, justCreated);
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 598dad993d1..aaeaf6c6817 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -239,7 +239,7 @@ namespace QueryTests {
{
// Check internal server handoff to getmore.
- Lock::DBLock lk(_txn.lockState(), "unittests", newlm::MODE_X);
+ Lock::DBWrite lk(_txn.lockState(), ns);
WriteUnitOfWork wunit(&_txn);
Client::Context ctx(&_txn, ns );
ClientCursorPin clientCursor( ctx.db()->getCollection(&_txn, ns), cursorId );
@@ -585,7 +585,7 @@ namespace QueryTests {
}
void run() {
const char *ns = "unittests.querytests.OplogReplaySlaveReadTill";
- Lock::DBLock lk(_txn.lockState(), "unittests", newlm::MODE_X);
+ Lock::DBWrite lk(_txn.lockState(), ns);
WriteUnitOfWork wunit(&_txn);
Client::Context ctx(&_txn, ns );
@@ -1401,7 +1401,7 @@ namespace QueryTests {
public:
CollectionInternalBase( const char *nsLeaf ) :
CollectionBase( nsLeaf ),
- _lk(_txn.lockState(), "unittests", newlm::MODE_X),
+ _lk(_txn.lockState(), ns() ),
_wunit( &_txn ),
_ctx(&_txn, ns()) {
}
@@ -1410,7 +1410,7 @@ namespace QueryTests {
}
private:
- Lock::DBLock _lk;
+ Lock::DBWrite _lk;
WriteUnitOfWork _wunit;
Client::Context _ctx;
};
diff --git a/src/mongo/dbtests/threadedtests.cpp b/src/mongo/dbtests/threadedtests.cpp
index 420c38f3d7f..797d1d72f6d 100644
--- a/src/mongo/dbtests/threadedtests.cpp
+++ b/src/mongo/dbtests/threadedtests.cpp
@@ -199,7 +199,7 @@ namespace ThreadedTests {
Lock::DBRead x(&lockState, "local");
}
{
- Lock::DBLock x(&lockState, "local", newlm::MODE_X);
+ Lock::DBWrite x(&lockState, "local");
// No actual writing here, so no WriteUnitOfWork
if( sometimes ) {
Lock::TempRelease t(&lockState);
@@ -211,11 +211,11 @@ namespace ThreadedTests {
}
{
- Lock::DBLock x(&lockState, "admin", newlm::MODE_X);
+ Lock::DBWrite x(&lockState, "admin");
}
}
else if( q == 3 ) {
- Lock::DBLock x(&lockState, "foo", newlm::MODE_X);
+ Lock::DBWrite x(&lockState, "foo");
Lock::DBRead y(&lockState, "admin");
}
else if( q == 4 ) {
@@ -223,7 +223,7 @@ namespace ThreadedTests {
Lock::DBRead y(&lockState, "admin");
}
else {
- Lock::DBLock w(&lockState, "foo", newlm::MODE_X);
+ Lock::DBWrite w(&lockState, "foo");
{
Lock::TempRelease t(&lockState);