comments and cleaning and safer

This commit is contained in:
dwight
2010-10-30 14:56:56 -04:00
parent 0bb17dfae1
commit 8e027b4f36
2 changed files with 24 additions and 16 deletions

View File

@@ -23,23 +23,10 @@
namespace mongo {
using namespace bson;
extern unsigned replSetForceInitialSyncFailure;
void startSyncThread() {
static int n;
assert( n == 0 );
n++;
Client::initThread("rs_sync");
cc().iAmSyncThread();
theReplSet->syncThread();
cc().shutdown();
}
/* apply the log op that is in param o */
void ReplSetImpl::syncApply(const BSONObj &o) {
//const char *op = o.getStringField("op");
char db[MaxDatabaseNameLen];
const char *ns = o.getStringField("ns");
nsToDatabase(ns, db);
@@ -58,6 +45,10 @@ namespace mongo {
applyOperation_inlock(o);
}
/* initial oplog application, during initial sync, after cloning.
@return false on failure.
this method returns an error and doesn't throw exceptions (i think).
*/
bool ReplSetImpl::initialSyncOplogApplication(
string hn,
const Member *primary,
@@ -397,7 +388,7 @@ namespace mongo {
}
catch(...) {
sethbmsg("unexpected exception in syncThread()");
// TODO : SET NOT SECONDARY here.
// TODO : SET NOT SECONDARY here?
sleepsecs(60);
}
sleepsecs(1);
@@ -410,4 +401,15 @@ namespace mongo {
}
}
void startSyncThread() {
static int n;
assert( n == 0 );
n++;
Client::initThread("rs_sync");
cc().iAmSyncThread();
theReplSet->syncThread();
cc().shutdown();
}
}