summaryrefslogtreecommitdiff
path: root/db/repl
diff options
context:
space:
mode:
authordwight <dwight@10gen.com>2010-11-07 15:02:48 -0500
committerdwight <dwight@10gen.com>2010-11-07 15:02:48 -0500
commitc7fa677e12cdc3ad93b38c2fc25d0be0669a23b2 (patch)
tree1007cde88de430743c7ebb7fe416c533c7701a3c /db/repl
parent623dfec394207f5332b1b24125a90da174871c90 (diff)
downloadmongo-c7fa677e12cdc3ad93b38c2fc25d0be0669a23b2.tar.gz
rs better error msgs and cleaning
Diffstat (limited to 'db/repl')
-rw-r--r--db/repl/rs.h2
-rw-r--r--db/repl/rs_initialsync.cpp17
-rw-r--r--db/repl/rs_sync.cpp2
3 files changed, 8 insertions, 13 deletions
diff --git a/db/repl/rs.h b/db/repl/rs.h
index 2a0671fbcfa..ed15061f30b 100644
--- a/db/repl/rs.h
+++ b/db/repl/rs.h
@@ -337,7 +337,7 @@ namespace mongo {
private:
/* pulling data from primary related - see rs_sync.cpp */
- bool initialSyncOplogApplication(string hn, const Member *primary, OpTime applyGTE, OpTime minValid);
+ bool initialSyncOplogApplication(const Member *primary, OpTime applyGTE, OpTime minValid);
void _syncDoInitialSync();
void syncDoInitialSync();
void _syncThread();
diff --git a/db/repl/rs_initialsync.cpp b/db/repl/rs_initialsync.cpp
index 5df10411692..9c29e17c0d1 100644
--- a/db/repl/rs_initialsync.cpp
+++ b/db/repl/rs_initialsync.cpp
@@ -111,7 +111,7 @@ namespace mongo {
const Member *cp = sp.primary;
if( cp == 0 ) {
- sethbmsg("initial sync need a member to be primary",0);
+ sethbmsg("initial sync need a member to be primary to do our initial sync", 0);
sleepsecs(15);
return;
}
@@ -132,14 +132,6 @@ namespace mongo {
}
OpTime startingTS = lastOp["ts"]._opTime();
- {
- /* make sure things aren't too flappy */
- sleepsecs(5);
- isyncassert( "flapping?", box.getPrimary() == cp );
- BSONObj o = r.getLastOp(rsoplog);
- isyncassert( "flapping [2]?", !o.isEmpty() );
- }
-
if (replSettings.fastsync) {
log() << "fastsync: skipping database clone" << rsLog;
}
@@ -171,10 +163,12 @@ namespace mongo {
sethbmsg("initial sync query minValid",0);
+ isyncassert( "initial sync source must remain primary throughout our initial sync", box.getPrimary() == cp );
+
/* our cloned copy will be strange until we apply oplog events that occurred
through the process. we note that time point here. */
BSONObj minValid = r.getLastOp(rsoplog);
- assert( !minValid.isEmpty() );
+ isyncassert( "getLastOp is empty ", !minValid.isEmpty() );
OpTime mvoptime = minValid["ts"]._opTime();
assert( !mvoptime.isNull() );
@@ -182,7 +176,8 @@ namespace mongo {
*/
{
sethbmsg("initial sync initial oplog application");
- if( ! initialSyncOplogApplication(masterHostname, cp, startingTS, mvoptime) ) { // note we assume here that this call does not throw
+ isyncassert( "initial sync source must remain primary throughout our initial sync [2]", box.getPrimary() == cp );
+ if( ! initialSyncOplogApplication(/*primary*/cp, /*applyGTE*/startingTS, /*minValid*/mvoptime) ) { // note we assume here that this call does not throw
log() << "replSet initial sync failed during applyoplog" << rsLog;
emptyOplog(); // otherwise we'll be up!
lastOpTimeWritten = OpTime();
diff --git a/db/repl/rs_sync.cpp b/db/repl/rs_sync.cpp
index 338b74b8f70..5d18add4939 100644
--- a/db/repl/rs_sync.cpp
+++ b/db/repl/rs_sync.cpp
@@ -50,13 +50,13 @@ namespace mongo {
this method returns an error and doesn't throw exceptions (i think).
*/
bool ReplSetImpl::initialSyncOplogApplication(
- string hn,
const Member *primary,
OpTime applyGTE,
OpTime minValid)
{
if( primary == 0 ) return false;
+ const string hn = primary->h().toString();
OpTime ts;
try {
OplogReader r;