Skip to content

Commit

Permalink
Fix up fail points to be compatible with parsing command line before …
Browse files Browse the repository at this point in the history
…running global initializers.

SERVER-7332
  • Loading branch information
Andy Schwerin committed Oct 23, 2012
1 parent ffd8aec commit 5589eb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/mongo/db/fail_point_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,21 @@ namespace mongo {
scoped_ptr<FaultInjectCmd> _faultInjectCmd(NULL);
scoped_ptr<FailPointRegistry> _fpRegistry(NULL);

MONGO_INITIALIZER(FailPointRegistry)(::mongo::InitializerContext* context) {
MONGO_INITIALIZER(FailPointRegistry)(InitializerContext* context) {
_fpRegistry.reset(new FailPointRegistry());
return Status::OK();
}

MONGO_INITIALIZER_GROUP(AllFaillPointsRegistered, (), ());
MONGO_INITIALIZER_GENERAL(AllFailPointsRegistered, (), ())(InitializerContext* context) {
_fpRegistry->freeze();
return Status::OK();
}

FailPointRegistry* getGlobalFailPointRegistry() {
return _fpRegistry.get();
}

void enableFailPointCmd() {
_faultInjectCmd.reset(new FaultInjectCmd);
_fpRegistry->freeze();
}
}
2 changes: 1 addition & 1 deletion src/mongo/db/fail_point_service.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ namespace mongo {
* never in a block with limited scope (ie, inside functions, loops, etc.)
*/
#define MONGO_FP_DECLARE(fp) FailPoint fp; \
MONGO_INITIALIZER_GENERAL(fp, ("FailPointRegistry"), ("AllFaillPointsRegistered")) \
MONGO_INITIALIZER_GENERAL(fp, ("FailPointRegistry"), ("AllFailPointsRegistered")) \
(::mongo::InitializerContext* context) { \
return getGlobalFailPointRegistry()->addFailPoint(#fp, &fp); \
}
Expand Down

0 comments on commit 5589eb5

Please sign in to comment.