summaryrefslogtreecommitdiff
path: root/src/mongo/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db')
-rw-r--r--src/mongo/db/repl/rs_rollback.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp
index 2f9b3bc34d6..b7e505ffac8 100644
--- a/src/mongo/db/repl/rs_rollback.cpp
+++ b/src/mongo/db/repl/rs_rollback.cpp
@@ -48,6 +48,7 @@
#include "mongo/db/catalog_raii.h"
#include "mongo/db/client.h"
#include "mongo/db/commands.h"
+#include "mongo/db/commands/txn_cmds_gen.h"
#include "mongo/db/concurrency/replication_state_transition_lock_guard.h"
#include "mongo/db/concurrency/write_conflict_exception.h"
#include "mongo/db/db_raii.h"
@@ -556,6 +557,17 @@ Status rollback_internal::updateFixUpInfoFromLocalOplogEntry(FixUpInfo& fixUpInf
}
return Status::OK();
}
+ // TODO(SERVER-39797): Remove commitTransaction handling for unprepared transactions.
+ case OplogEntry::CommandType::kCommitTransaction: {
+ IDLParserErrorContext ctx("commitTransaction");
+ auto commitCommand = CommitTransactionOplogObject::parse(ctx, obj);
+ const bool prepared = !commitCommand.getPrepared() || *commitCommand.getPrepared();
+ if (!prepared) {
+ log() << "Ignoring unprepared commitTransaction during rollback: "
+ << redact(oplogEntry.toBSON());
+ return Status::OK();
+ }
+ }
default: {
std::string message = str::stream() << "Can't roll back this command yet: "
<< " cmdname = " << first.fieldName();