diff options
author | Dan Pasette <dan@10mongodb.com> | 2014-03-08 15:58:43 -0500 |
---|---|---|
committer | Dan Pasette <dan@mongodb.com> | 2014-03-09 11:27:35 -0400 |
commit | 801d87f5c8d66d5f5a462c5e0daae67e6b848976 (patch) | |
tree | f6374ceb23dec18ad9f3453ca1f11d00e8b9e6b8 | |
parent | ae451ca13f2803b315a136a0efebcc123129f069 (diff) | |
download | mongo-801d87f5c8d66d5f5a462c5e0daae67e6b848976.tar.gz |
SERVER-8375 sync from primary on clock skew
Manual backport of git commit ebd13ab35a338370a44e3e2891a06d31718f83aa
-rw-r--r-- | src/mongo/db/oplog.cpp | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/src/mongo/db/oplog.cpp b/src/mongo/db/oplog.cpp index b88ad66ac03..33990367d92 100644 --- a/src/mongo/db/oplog.cpp +++ b/src/mongo/db/oplog.cpp @@ -95,7 +95,15 @@ namespace mongo { */ if( theReplSet ) { if( !(theReplSet->lastOpTimeWritten<ts) ) { - log() << "replSet error possible failover clock skew issue? " << theReplSet->lastOpTimeWritten.toString() << ' ' << endl; + log() << "replication oplog stream went back in time. previous timestamp: " + << theReplSet->lastOpTimeWritten << " newest timestamp: " << ts + << ". attempting to sync directly from primary." << endl; + std::string errmsg; + BSONObjBuilder result; + if (!theReplSet->forceSyncFrom(theReplSet->box.getPrimary()->fullName(), + errmsg, result)) { + log() << "Can't sync from primary: " << errmsg << endl; + } } theReplSet->lastOpTimeWritten = ts; theReplSet->lastH = h; @@ -222,8 +230,15 @@ namespace mongo { */ if( theReplSet ) { if( !(theReplSet->lastOpTimeWritten<ts) ) { - log() << "replSet ERROR possible failover clock skew issue? " << theReplSet->lastOpTimeWritten << ' ' << ts << rsLog; - log() << "replSet " << theReplSet->isPrimary() << rsLog; + log() << "replication oplog stream went back in time. previous timestamp: " + << theReplSet->lastOpTimeWritten << " newest timestamp: " << ts + << ". attempting to sync directly from primary." << endl; + std::string errmsg; + BSONObjBuilder result; + if (!theReplSet->forceSyncFrom(theReplSet->box.getPrimary()->fullName(), + errmsg, result)) { + log() << "Can't sync from primary: " << errmsg << endl; + } } theReplSet->lastOpTimeWritten = ts; theReplSet->lastH = hashNew; |