summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorSuganthi Mani <suganthi.mani@mongodb.com>2019-02-21 11:31:19 -0500
committerSuganthi Mani <suganthi.mani@mongodb.com>2019-02-26 10:04:13 -0500
commit72425ec865efeeea9c1cb61c4cde9393fd4dc9d5 (patch)
treee08f7056fe6379ad29a5c3b35f70cea82e70c4a2 /src/mongo/db/repl
parent6bf33306809526707fa08b93a0d8ee19eae0f9e9 (diff)
downloadmongo-72425ec865efeeea9c1cb61c4cde9393fd4dc9d5.tar.gz
SERVER-39035 Specify durable_timestamp when committing prepared transaction.
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/oplog.cpp2
-rw-r--r--src/mongo/db/repl/transaction_oplog_application.cpp19
-rw-r--r--src/mongo/db/repl/transaction_oplog_application.h3
3 files changed, 5 insertions, 19 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 60686355eec..f7c8b4ccacb 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -1312,7 +1312,7 @@ std::map<std::string, ApplyOpMetadata> opsMap = {
const OplogEntry& entry,
OplogApplication::Mode mode,
boost::optional<Timestamp> stableTimestampForRecovery) -> Status {
- return applyCommitTransaction(opCtx, entry, mode, stableTimestampForRecovery);
+ return applyCommitTransaction(opCtx, entry, mode);
}}},
{"abortTransaction",
{[](OperationContext* opCtx,
diff --git a/src/mongo/db/repl/transaction_oplog_application.cpp b/src/mongo/db/repl/transaction_oplog_application.cpp
index 6628fff7640..b9dbd9a5953 100644
--- a/src/mongo/db/repl/transaction_oplog_application.cpp
+++ b/src/mongo/db/repl/transaction_oplog_application.cpp
@@ -71,8 +71,7 @@ Status _applyTransactionFromOplogChain(OperationContext* opCtx,
Status applyCommitTransaction(OperationContext* opCtx,
const repl::OplogEntry& entry,
- repl::OplogApplication::Mode mode,
- boost::optional<Timestamp> stableTimestampForRecovery) {
+ repl::OplogApplication::Mode mode) {
// Return error if run via applyOps command.
uassert(50987,
"commitTransaction is only used internally by secondaries.",
@@ -81,20 +80,8 @@ Status applyCommitTransaction(OperationContext* opCtx,
IDLParserErrorContext ctx("commitTransaction");
auto commitCommand = CommitTransactionOplogObject::parse(ctx, entry.getObject());
- if (mode == repl::OplogApplication::Mode::kRecovering) {
- invariant(stableTimestampForRecovery);
-
- // If the commitTimestamp is before the stableTimestampForRecovery, then the data
- // already reflects the operations from the transaction.
- const auto& commitTimestamp = commitCommand.getCommitTimestamp();
- if (stableTimestampForRecovery.get() > commitTimestamp) {
- return Status::OK();
- }
-
- return _applyTransactionFromOplogChain(opCtx, entry, mode);
- }
-
- if (mode == repl::OplogApplication::Mode::kInitialSync) {
+ if (mode == repl::OplogApplication::Mode::kRecovering ||
+ mode == repl::OplogApplication::Mode::kInitialSync) {
return _applyTransactionFromOplogChain(opCtx, entry, mode);
}
diff --git a/src/mongo/db/repl/transaction_oplog_application.h b/src/mongo/db/repl/transaction_oplog_application.h
index f671f8724f9..ee2c77b722d 100644
--- a/src/mongo/db/repl/transaction_oplog_application.h
+++ b/src/mongo/db/repl/transaction_oplog_application.h
@@ -40,8 +40,7 @@ namespace mongo {
*/
Status applyCommitTransaction(OperationContext* opCtx,
const repl::OplogEntry& entry,
- repl::OplogApplication::Mode mode,
- boost::optional<Timestamp> stableTimestampForRecovery);
+ repl::OplogApplication::Mode mode);
/**
* Apply `abortTransaction` oplog entry.