mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
fixes for replacepeer (replica pair functionality)
This commit is contained in:
parent
e6e8900f73
commit
e02a96f48a
11
db/repl.cpp
11
db/repl.cpp
@ -192,8 +192,16 @@ public:
|
||||
errmsg = "timeout waiting for sync() to finish";
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
vector<ReplSource*> sources;
|
||||
ReplSource::loadAll(sources);
|
||||
if( sources.size() != 1 ) {
|
||||
errmsg = "local.sources.count() != 1, cannot replace peer";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
{
|
||||
emptyCollection("local.sources");
|
||||
BSONObj o = fromjson("{replacepeer:1}");
|
||||
putSingleton("local.pair.startup", o);
|
||||
}
|
||||
@ -515,6 +523,7 @@ void ReplSource::loadAll(vector<ReplSource*>& v) {
|
||||
ReplSource *s = new ReplSource();
|
||||
s->paired = true;
|
||||
s->hostName = replPair->remote;
|
||||
s->replacing = replacePeer;
|
||||
v.push_back(s);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user