diff options
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/SConscript | 5 | ||||
-rw-r--r-- | src/mongo/db/commands/fail_point_cmd.cpp (renamed from src/mongo/db/fail_point_service.cpp) | 20 | ||||
-rw-r--r-- | src/mongo/db/commands/fail_point_cmd.h | 24 | ||||
-rw-r--r-- | src/mongo/db/db.cpp | 2 | ||||
-rw-r--r-- | src/mongo/s/server.cpp | 2 | ||||
-rw-r--r-- | src/mongo/util/fail_point_service.cpp | 37 | ||||
-rw-r--r-- | src/mongo/util/fail_point_service.h (renamed from src/mongo/db/fail_point_service.h) | 7 |
7 files changed, 68 insertions, 29 deletions
diff --git a/src/mongo/SConscript b/src/mongo/SConscript index e13b2bcabda..9c2e0cea108 100644 --- a/src/mongo/SConscript +++ b/src/mongo/SConscript @@ -127,7 +127,8 @@ commonFiles += processInfoFiles env.StaticLibrary("fail_point", ["util/fail_point.cpp", - "util/fail_point_registry.cpp"], + "util/fail_point_registry.cpp", + "util/fail_point_service.cpp"], LIBDEPS=["foundation", "bson"]) env.StaticLibrary('mongocommon', commonFiles, @@ -144,10 +145,10 @@ env.StaticLibrary('mongocommon', commonFiles, env.StaticLibrary("coredb", [ "client/parallel.cpp", "db/commands.cpp", + "db/commands/fail_point_cmd.cpp", "db/commands/hashcmd.cpp", "db/commands/isself.cpp", "db/commands/server_status.cpp", - "db/fail_point_service.cpp", "db/pipeline/pipeline.cpp", "db/dbcommands_generic.cpp", "db/dbwebserver.cpp", diff --git a/src/mongo/db/fail_point_service.cpp b/src/mongo/db/commands/fail_point_cmd.cpp index a7d8cee1a40..88616b39197 100644 --- a/src/mongo/db/fail_point_service.cpp +++ b/src/mongo/db/commands/fail_point_cmd.cpp @@ -14,13 +14,12 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ -#include "mongo/db/fail_point_service.h" +#include "mongo/db/commands/fail_point_cmd.h" #include "mongo/db/commands.h" +#include "mongo/util/fail_point_service.h" namespace mongo { - MONGO_FP_DECLARE(dummy); // used by jstests/libs/fail_point.js - /** * Command for modifying installed fail points. * @@ -142,21 +141,6 @@ namespace mongo { }; scoped_ptr<FaultInjectCmd> _faultInjectCmd(NULL); - scoped_ptr<FailPointRegistry> _fpRegistry(NULL); - - MONGO_INITIALIZER(FailPointRegistry)(InitializerContext* context) { - _fpRegistry.reset(new FailPointRegistry()); - return Status::OK(); - } - - MONGO_INITIALIZER_GENERAL(AllFailPointsRegistered, (), ())(InitializerContext* context) { - _fpRegistry->freeze(); - return Status::OK(); - } - - FailPointRegistry* getGlobalFailPointRegistry() { - return _fpRegistry.get(); - } void enableFailPointCmd() { _faultInjectCmd.reset(new FaultInjectCmd); diff --git a/src/mongo/db/commands/fail_point_cmd.h b/src/mongo/db/commands/fail_point_cmd.h new file mode 100644 index 00000000000..e485da10608 --- /dev/null +++ b/src/mongo/db/commands/fail_point_cmd.h @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2012 10gen Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +namespace mongo { + /** + * Installs the injectFault command. + * + * Note: not thread-safe + */ + void enableFailPointCmd(); +} diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp index 32eacdbae22..c2f489854bd 100644 --- a/src/mongo/db/db.cpp +++ b/src/mongo/db/db.cpp @@ -27,13 +27,13 @@ #include "mongo/db/clientcursor.h" #include "mongo/db/cmdline.h" #include "mongo/db/commands/server_status.h" +#include "mongo/db/commands/fail_point_cmd.h" #include "mongo/db/d_concurrency.h" #include "mongo/db/d_globals.h" #include "mongo/db/db.h" #include "mongo/db/dbmessage.h" #include "mongo/db/dbwebserver.h" #include "mongo/db/dur.h" -#include "mongo/db/fail_point_service.h" #include "mongo/db/initialize_server_global_state.h" #include "mongo/db/instance.h" #include "mongo/db/introspect.h" diff --git a/src/mongo/s/server.cpp b/src/mongo/s/server.cpp index 9ac9b1824c3..09b6973e979 100644 --- a/src/mongo/s/server.cpp +++ b/src/mongo/s/server.cpp @@ -21,6 +21,7 @@ #include <boost/thread/thread.hpp> #include "mongo/base/initializer.h" +#include "mongo/db/commands/fail_point_cmd.h" #include "mongo/db/initialize_server_global_state.h" #include "../util/net/message.h" #include "../util/startup_test.h" @@ -45,7 +46,6 @@ #include "cursors.h" #include "shard_version.h" #include "../util/processinfo.h" -#include "mongo/db/fail_point_service.h" #include "mongo/db/lasterror.h" #include "mongo/util/stacktrace.h" diff --git a/src/mongo/util/fail_point_service.cpp b/src/mongo/util/fail_point_service.cpp new file mode 100644 index 00000000000..b474810ddaf --- /dev/null +++ b/src/mongo/util/fail_point_service.cpp @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2012 10gen Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#include "mongo/util/fail_point_service.h" + +namespace mongo { + MONGO_FP_DECLARE(dummy); // used by jstests/libs/fail_point.js + + scoped_ptr<FailPointRegistry> _fpRegistry(NULL); + + MONGO_INITIALIZER(FailPointRegistry)(InitializerContext* context) { + _fpRegistry.reset(new FailPointRegistry()); + return Status::OK(); + } + + MONGO_INITIALIZER_GENERAL(AllFailPointsRegistered, (), ())(InitializerContext* context) { + _fpRegistry->freeze(); + return Status::OK(); + } + + FailPointRegistry* getGlobalFailPointRegistry() { + return _fpRegistry.get(); + } +} diff --git a/src/mongo/db/fail_point_service.h b/src/mongo/util/fail_point_service.h index 608812d687e..57efe73fdd3 100644 --- a/src/mongo/db/fail_point_service.h +++ b/src/mongo/util/fail_point_service.h @@ -30,13 +30,6 @@ namespace mongo { FailPointRegistry* getGlobalFailPointRegistry(); /** - * Installs the injectFault command and freezes the fail point registry. - * - * Note: not thread-safe - */ - void enableFailPointCmd(); - - /** * Convenience macro for declaring a fail point. Must be used in global scope and * never in a block with limited scope (ie, inside functions, loops, etc.) */ |