summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/roll_back_local_operations.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2016-08-15 19:06:30 -0400
committerMathias Stearn <mathias@10gen.com>2016-08-23 10:49:55 -0400
commit34c6c691a038eac1ac3ee16e1eedc54aab964774 (patch)
tree7a0776eba2e12ade082628f1654aee3a753feb57 /src/mongo/db/repl/roll_back_local_operations.cpp
parent3bcafe4fe23c9521fe028a176fffabdc79d434e9 (diff)
downloadmongo-34c6c691a038eac1ac3ee16e1eedc54aab964774.tar.gz
SERVER-7200 Write oplog entries on secondaries before applying
Diffstat (limited to 'src/mongo/db/repl/roll_back_local_operations.cpp')
-rw-r--r--src/mongo/db/repl/roll_back_local_operations.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/src/mongo/db/repl/roll_back_local_operations.cpp b/src/mongo/db/repl/roll_back_local_operations.cpp
index 2117458e9f4..92312d0d21c 100644
--- a/src/mongo/db/repl/roll_back_local_operations.cpp
+++ b/src/mongo/db/repl/roll_back_local_operations.cpp
@@ -41,6 +41,10 @@ namespace repl {
namespace {
+OpTime getOpTime(const OplogInterface::Iterator::Value& oplogValue) {
+ return fassertStatusOK(40298, OpTime::parseFromOplogEntry(oplogValue.first));
+}
+
Timestamp getTimestamp(const BSONObj& operation) {
return operation["ts"].timestamp();
}
@@ -116,7 +120,7 @@ StatusWith<RollBackLocalOperations::RollbackCommonPoint> RollBackLocalOperations
_scanned++;
if (getHash(_localOplogValue) == getHash(operation)) {
return StatusWith<RollbackCommonPoint>(
- std::make_pair(getTimestamp(_localOplogValue), _localOplogValue.second));
+ std::make_pair(getOpTime(_localOplogValue), _localOplogValue.second));
}
auto status = _rollbackOperation(_localOplogValue.first);
if (!status.isOK()) {
@@ -139,14 +143,11 @@ StatusWith<RollBackLocalOperations::RollbackCommonPoint> RollBackLocalOperations
"Need to process additional remote operations.");
}
- if (getTimestamp(_localOplogValue) < getTimestamp(operation)) {
- _scanned++;
- return StatusWith<RollbackCommonPoint>(ErrorCodes::NoSuchKey,
- "Unable to determine common point. "
- "Need to process additional remote operations.");
- }
-
- return RollbackCommonPoint(Timestamp(Seconds(1), 0), RecordId());
+ invariant(getTimestamp(_localOplogValue) < getTimestamp(operation));
+ _scanned++;
+ return StatusWith<RollbackCommonPoint>(ErrorCodes::NoSuchKey,
+ "Unable to determine common point. "
+ "Need to process additional remote operations.");
}
StatusWith<RollBackLocalOperations::RollbackCommonPoint> syncRollBackLocalOperations(