Skip to content

Commit

Permalink
SERVER-7367 Add default constructor for empty config
Browse files Browse the repository at this point in the history
  • Loading branch information
kchodorow committed Nov 6, 2012
1 parent ea86be5 commit 43efcff
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/mongo/db/repl/rs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -681,8 +681,11 @@ namespace mongo {
DBDirectClient cli;
BSONObj config = cli.findOne(rsConfigNs, Query()).getOwned();

// Add local config, if it exists
if (!config.isEmpty()) {
// Add local config
if (config.isEmpty()) {
configs.push_back(ReplSetConfig());
}
else {
configs.push_back(ReplSetConfig(config, false));
}
}
Expand Down
4 changes: 4 additions & 0 deletions src/mongo/db/repl/rs_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,10 @@ namespace mongo {
uassert(13122, "bad repl set config?", expr);
}

ReplSetConfig::ReplSetConfig() :
version(EMPTYCONFIG),_ok(false),_majority(-1)
{}

ReplSetConfig::ReplSetConfig(BSONObj cfg, bool force) :
_ok(false),_chainingAllowed(true),_majority(-1)
{
Expand Down
1 change: 1 addition & 0 deletions src/mongo/db/repl/rs_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ namespace mongo {
// Protects _groups.
static mongo::mutex groupMx;
public:
ReplSetConfig();
/**
* This contacts the given host and tries to get a config from them.
*
Expand Down

0 comments on commit 43efcff

Please sign in to comment.