diff options
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r-- | src/mongo/db/repl/rs_rollback.cpp | 11 | ||||
-rw-r--r-- | src/mongo/db/repl/sync_tail.cpp | 40 |
2 files changed, 0 insertions, 51 deletions
diff --git a/src/mongo/db/repl/rs_rollback.cpp b/src/mongo/db/repl/rs_rollback.cpp index 6de2fbdf650..44c40e4f40e 100644 --- a/src/mongo/db/repl/rs_rollback.cpp +++ b/src/mongo/db/repl/rs_rollback.cpp @@ -593,17 +593,6 @@ Status rollback_internal::updateFixUpInfoFromLocalOplogEntry(OperationContext* o case OplogEntry::CommandType::kAbortTransaction: { return Status::OK(); } - // TODO(SERVER-40728): 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(); diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 0b93b7d373b..1b776f2ccf6 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -844,15 +844,6 @@ void SyncTail::_oplogApplication(ReplicationCoordinator* replCoord, } } -// Returns whether an oplog entry represents a commitTransaction for a transaction which has not -// been prepared. An entry is an unprepared commit if it has a boolean "prepared" field set to -// false. -inline bool isUnpreparedCommit(const OplogEntry& entry) { - return entry.getCommandType() == OplogEntry::CommandType::kCommitTransaction && - entry.getObject()[CommitTransactionOplogObject::kPreparedFieldName].isBoolean() && - !entry.getObject()[CommitTransactionOplogObject::kPreparedFieldName].boolean(); -} - // Returns whether an oplog entry represents an applyOps which is a self-contained atomic operation, // or the last applyOps of an unprepared transaction, as opposed to part of a prepared transaction // or a non-final applyOps in an transaction. @@ -1233,37 +1224,6 @@ void SyncTail::_fillWriterVectors(OperationContext* opCtx, << redact(op.toBSON()))); } continue; - } else if (isUnpreparedCommit(op)) { - // TODO(SERVER-40728): Remove this block after SERVER-40676 because we will no longer - // emit a commitTransaction oplog entry for an unprepared transaction. This code will - // no longer be reachable because we will commit the unprepared transaction on the last - // applyOps oplog entry, which will not contain a partialTxn field. - - // On commit of unprepared transactions, get transactional operations from the oplog and - // fill writers with those operations. - try { - invariant(derivedOps); - auto& partialTxnList = partialTxnOps[*op.getSessionId()]; - { - // We need to use a ReadSourceScope avoid the reads of the transaction messing - // up the state of the opCtx. In particular we do not want to set the - // ReadSource to kLastApplied. - ReadSourceScope readSourceScope(opCtx); - derivedOps->emplace_back( - readTransactionOperationsFromOplogChain(opCtx, op, partialTxnList)); - partialTxnList.clear(); - } - // Transaction entries cannot have different session updates. - _fillWriterVectors(opCtx, &derivedOps->back(), writerVectors, derivedOps, nullptr); - } catch (...) { - fassertFailedWithStatusNoTrace( - 51116, - exceptionToStatus().withContext(str::stream() - << "Unable to read operations for transaction " - << "commit " - << redact(op.toBSON()))); - } - continue; } auto& writer = (*writerVectors)[hash % numWriters]; |