diff options
author | Mathias Stearn <redbeard0531@gmail.com> | 2016-10-07 18:42:20 -0400 |
---|---|---|
committer | Mathias Stearn <redbeard0531@gmail.com> | 2016-10-17 14:36:31 -0400 |
commit | 5db0a55a264ee326bff5598249639ef479628f37 (patch) | |
tree | 8a92aadd22d5be199af9b87e1f6388f1bd0ec632 /src/mongo/db/repl/rs_rollback.cpp | |
parent | 99f8d760848b0be69b8934b00d33552b1295d5d9 (diff) | |
download | mongo-5db0a55a264ee326bff5598249639ef479628f37.tar.gz |
SERVER-7200 Write oplog entries on secondaries before applying
Manual backport of 34c6c691a038eac1ac3ee16e1eedc54aab964774 along with fixes
and tests from:
b5d2b06f8a08171fd96ef8d128c4f7ecedcb8f93
dc83fb0433fcae6e72f035df7458473b59223eb5
fec839b99f4b9e08016112fe8b9492e327af91b8
bf86770c8a5de97b30bc008ad59e34de99065c60
Diffstat (limited to 'src/mongo/db/repl/rs_rollback.cpp')
-rw-r--r-- | src/mongo/db/repl/rs_rollback.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index d52032cb6a4..7b40e510127 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -159,7 +159,7 @@ struct FixUpInfo { set<string> collectionsToResyncData; set<string> collectionsToResyncMetadata; - Timestamp commonPoint; + OpTime commonPoint; RecordId commonPointOurDiskloc; int rbid; // remote server's current rollback sequence # @@ -391,9 +391,12 @@ void syncFixUp(OperationContext* txn, // we have items we are writing that aren't from a point-in-time. thus best not to come // online until we get to that point in freshness. + // TODO this is still wrong because we don't record that we are in rollback, and we can't really + // recover. OpTime minValid = fassertStatusOK(28774, OpTime::parseFromOplogEntry(newMinValid)); log() << "minvalid=" << minValid; - setMinValid(txn, {OpTime{}, minValid}); + setAppliedThrough(txn, {}); // Use top of oplog. + setMinValid(txn, minValid); // any full collection resyncs required? if (!fixUpInfo.collectionsToResyncData.empty() || @@ -497,8 +500,8 @@ void syncFixUp(OperationContext* txn, } else { OpTime minValid = fassertStatusOK(28775, OpTime::parseFromOplogEntry(newMinValid)); log() << "minvalid=" << minValid; - const OpTime start{fixUpInfo.commonPoint, OpTime::kUninitializedTerm}; - setMinValid(txn, {start, minValid}); + setMinValid(txn, minValid); + setAppliedThrough(txn, fixUpInfo.commonPoint); } } catch (const DBException& e) { err = "can't get/set minvalid: "; @@ -768,7 +771,7 @@ void syncFixUp(OperationContext* txn, log() << "rollback 6"; // clean up oplog - LOG(2) << "rollback truncate oplog after " << fixUpInfo.commonPoint.toStringPretty(); + LOG(2) << "rollback truncate oplog after " << fixUpInfo.commonPoint; { const NamespaceString oplogNss(rsOplogName); ScopedTransaction transaction(txn, MODE_IX); |