summaryrefslogtreecommitdiff
path: root/src/mongo/dbtests
diff options
context:
space:
mode:
authorHari Khalsa <hkhalsa@10gen.com>2014-06-05 17:34:48 -0400
committerHari Khalsa <hkhalsa@10gen.com>2014-06-06 13:31:47 -0400
commit7e55849f500e040d5c21f1f6cd7aeb0878d11970 (patch)
tree92ece2a9d65bece0a1dd48bfe9fa2693c500fb93 /src/mongo/dbtests
parenta71c42dabfce208709ef63a1c90aefcea15198e6 (diff)
downloadmongo-7e55849f500e040d5c21f1f6cd7aeb0878d11970.tar.gz
SERVER-14069 move killCurrentOp impl into the only place that calls it
Diffstat (limited to 'src/mongo/dbtests')
-rw-r--r--src/mongo/dbtests/dbtests.cpp3
-rw-r--r--src/mongo/dbtests/indexupdatetests.cpp26
-rw-r--r--src/mongo/dbtests/querytests.cpp8
3 files changed, 20 insertions, 17 deletions
diff --git a/src/mongo/dbtests/dbtests.cpp b/src/mongo/dbtests/dbtests.cpp
index e0fd9f7b73e..7e056fb924b 100644
--- a/src/mongo/dbtests/dbtests.cpp
+++ b/src/mongo/dbtests/dbtests.cpp
@@ -36,6 +36,8 @@
#include "mongo/db/auth/authorization_manager.h"
#include "mongo/db/auth/authorization_manager_global.h"
#include "mongo/db/auth/authz_manager_external_state_mock.h"
+#include "mongo/db/global_environment_d.h"
+#include "mongo/db/global_environment_experiment.h"
#include "mongo/db/repl/repl_coordinator_global.h"
#include "mongo/db/repl/repl_coordinator_mock.h"
#include "mongo/dbtests/dbtests.h"
@@ -55,6 +57,7 @@ int dbtestsMain( int argc, char** argv, char** envp ) {
static StaticObserver StaticObserver;
setWindowsUnhandledExceptionFilter();
setGlobalAuthorizationManager(new AuthorizationManager(new AuthzManagerExternalStateMock()));
+ setGlobalEnvironment(new GlobalEnvironmentMongoD());
repl::setGlobalReplicationCoordinator(new repl::ReplicationCoordinatorMock());
Command::testCommandsEnabled = 1;
mongo::runGlobalInitializersOrDie(argc, argv, envp);
diff --git a/src/mongo/dbtests/indexupdatetests.cpp b/src/mongo/dbtests/indexupdatetests.cpp
index 5d403a503cd..6fb11363da6 100644
--- a/src/mongo/dbtests/indexupdatetests.cpp
+++ b/src/mongo/dbtests/indexupdatetests.cpp
@@ -62,7 +62,7 @@ namespace IndexUpdateTests {
}
~IndexBuildBase() {
_client.dropCollection( _ns );
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
}
Collection* collection() {
return _ctx.ctx().db()->getCollection( &_txn, _ns );
@@ -332,13 +332,13 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "a" << 1 ) << "ns" << _ns << "name" << "a_1" );
// The call is interrupted because mayInterrupt == true.
Status status = coll->getIndexCatalog()->createIndex(&_txn, indexInfo, true );
ASSERT_NOT_OK( status.code() );
// only want to interrupt the index build
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// The new index is not listed in the index catalog because the index build failed.
ASSERT( !coll->getIndexCatalog()->findIndexByName( "a_1" ) );
}
@@ -361,13 +361,13 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "a" << 1 ) << "ns" << _ns << "name" << "a_1" );
// The call is not interrupted because mayInterrupt == false.
Status status = coll->getIndexCatalog()->createIndex(&_txn, indexInfo, false );
ASSERT_OK( status.code() );
// only want to interrupt the index build
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// The new index is listed in the index catalog because the index build completed.
ASSERT( coll->getIndexCatalog()->findIndexByName( "a_1" ) );
}
@@ -393,7 +393,7 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "_id" << 1 ) <<
"ns" << _ns <<
"name" << "_id_" );
@@ -401,7 +401,7 @@ namespace IndexUpdateTests {
Status status = coll->getIndexCatalog()->createIndex(&_txn, indexInfo, true );
ASSERT_NOT_OK( status.code() );
// only want to interrupt the index build
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// The new index is not listed in the index catalog because the index build failed.
ASSERT( !coll->getIndexCatalog()->findIndexByName( "_id_" ) );
}
@@ -427,7 +427,7 @@ namespace IndexUpdateTests {
// Initialize curop.
_txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
BSONObj indexInfo = BSON( "key" << BSON( "_id" << 1 ) <<
"ns" << _ns <<
"name" << "_id_" );
@@ -435,7 +435,7 @@ namespace IndexUpdateTests {
Status status = coll->getIndexCatalog()->createIndex(&_txn, indexInfo, false );
ASSERT_OK( status.code() );
// only want to interrupt the index build
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// The new index is listed in the index catalog because the index build succeeded.
ASSERT( coll->getIndexCatalog()->findIndexByName( "_id_" ) );
}
@@ -454,11 +454,11 @@ namespace IndexUpdateTests {
_txn.getCurOp()->reset();
// Request an interrupt. killAll() rather than kill() is required because the direct
// client will build the index using a new opid.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
// The call is not interrupted.
_client.ensureIndex( _ns, BSON( "a" << 1 ) );
// only want to interrupt the index build
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// The new index is listed in system.indexes because the index build completed.
ASSERT_EQUALS( 1U,
_client.count( "unittests.system.indexes",
@@ -479,11 +479,11 @@ namespace IndexUpdateTests {
// Initialize curop.
txn.getCurOp()->reset();
// Request an interrupt.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
// The call is not interrupted.
Helpers::ensureIndex( &txn, collection(), BSON( "a" << 1 ), false, "a_1" );
// only want to interrupt the index build
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// The new index is listed in system.indexes because the index build completed.
ASSERT_EQUALS( 1U,
_client.count( "unittests.system.indexes",
diff --git a/src/mongo/dbtests/querytests.cpp b/src/mongo/dbtests/querytests.cpp
index 5bd84662b8e..0ef81145036 100644
--- a/src/mongo/dbtests/querytests.cpp
+++ b/src/mongo/dbtests/querytests.cpp
@@ -274,7 +274,7 @@ namespace QueryTests {
class GetMoreKillOp : public ClientBase {
public:
~GetMoreKillOp() {
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
client().dropCollection( "unittests.querytests.GetMoreKillOp" );
}
void run() {
@@ -297,13 +297,13 @@ namespace QueryTests {
// Set the killop kill all flag, forcing the next get more to fail with a kill op
// exception.
- getGlobalEnvironment()->killAllOperations();
+ getGlobalEnvironment()->setKillAllOperations();
while( cursor->more() ) {
cursor->next();
}
// Revert the killop kill all flag.
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
// Check that the cursor has been removed.
{
@@ -326,7 +326,7 @@ namespace QueryTests {
class GetMoreInvalidRequest : public ClientBase {
public:
~GetMoreInvalidRequest() {
- getGlobalEnvironment()->resetOperationKillState();
+ getGlobalEnvironment()->unsetKillAllOperations();
client().dropCollection( "unittests.querytests.GetMoreInvalidRequest" );
}
void run() {