0
0
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:
Dwight 2008-12-15 18:00:10 -05:00
parent e6e8900f73
commit e02a96f48a

View File

@ -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);
}