diff options
author | auto-revert-processor <dev-prod-dag@mongodb.com> | 2022-02-08 13:40:10 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-02-08 15:03:40 +0000 |
commit | 19136e15f4968859cd583b883a2c160d3945def8 (patch) | |
tree | 78cadf9e00764dcc9d223a7d4898253c5184e518 /src | |
parent | 39023ede35ec30e652e643a060cdd699b6ca90c1 (diff) | |
download | mongo-19136e15f4968859cd583b883a2c160d3945def8.tar.gz |
Revert "SERVER-58694 Implement writing of pre-images for transactional update/replace/delete operations"
This reverts commit 54c977ae2b278136a87f4dd46e81bed3d5224d8e.
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/op_observer_impl.cpp | 84 | ||||
-rw-r--r-- | src/mongo/db/pipeline/change_stream_pre_image_helpers.cpp | 8 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream.h | 1 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream_transform.cpp | 12 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h | 12 | ||||
-rw-r--r-- | src/mongo/db/repl/apply_ops_command_info.cpp | 17 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 13 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_entry.cpp | 31 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_entry.h | 122 | ||||
-rw-r--r-- | src/mongo/db/transaction_participant.cpp | 5 |
11 files changed, 19 insertions, 289 deletions
diff --git a/src/mongo/db/op_observer_impl.cpp b/src/mongo/db/op_observer_impl.cpp index b8a7b4f28e3..895845a0fde 100644 --- a/src/mongo/db/op_observer_impl.cpp +++ b/src/mongo/db/op_observer_impl.cpp @@ -80,7 +80,6 @@ namespace mongo { using repl::DurableOplogEntry; using repl::MutableOplogEntry; -using ChangeStreamPreImageRecordingMode = repl::ReplOperation::ChangeStreamPreImageRecordingMode; const OperationContext::Decoration<boost::optional<repl::DocumentKey>> documentKeyDecoration = OperationContext::declareDecoration<boost::optional<repl::DocumentKey>>(); @@ -640,7 +639,6 @@ void OpObserverImpl::onUpdate(OperationContext* opCtx, const OplogUpdateEntryArg if (args.updateArgs->storeDocOption == CollectionUpdateArgs::StoreDocOption::PreImage) { invariant(args.updateArgs->preImageDoc); operation.setPreImage(args.updateArgs->preImageDoc->getOwned()); - operation.setPreImageRecordedForRetryableInternalTransaction(); if (args.retryableFindAndModifyLocation == RetryableFindAndModifyLocation::kSideCollection) { operation.setNeedsRetryImage(repl::RetryImageEnum::kPreImage); @@ -657,26 +655,7 @@ void OpObserverImpl::onUpdate(OperationContext* opCtx, const OplogUpdateEntryArg } } else if (args.updateArgs->preImageRecordingEnabledForCollection) { invariant(args.updateArgs->preImageDoc); - tassert( - 5869402, - "Change stream pre-image recording to the oplog and to the pre-image collection " - "requested at the same time", - !args.updateArgs->changeStreamPreAndPostImagesEnabledForCollection); operation.setPreImage(args.updateArgs->preImageDoc->getOwned()); - operation.setChangeStreamPreImageRecordingMode( - ChangeStreamPreImageRecordingMode::kOplog); - } - - if (args.updateArgs->changeStreamPreAndPostImagesEnabledForCollection) { - invariant(args.updateArgs->preImageDoc); - tassert( - 5869403, - "Change stream pre-image recording to the oplog and to the pre-image collection " - "requested at the same time", - !args.updateArgs->preImageRecordingEnabledForCollection); - operation.setPreImage(args.updateArgs->preImageDoc->getOwned()); - operation.setChangeStreamPreImageRecordingMode( - ChangeStreamPreImageRecordingMode::kPreImagesCollection); } operation.setDestinedRecipient( shardingWriteRouter.getReshardingDestinedRecipient(args.updateArgs->updatedDoc)); @@ -834,33 +813,17 @@ void OpObserverImpl::onDelete(OperationContext* opCtx, "Deleted document must be present for pre-image recording", args.deletedDoc); operation.setPreImage(args.deletedDoc->getOwned()); - operation.setPreImageRecordedForRetryableInternalTransaction(); if (args.retryableFindAndModifyLocation == RetryableFindAndModifyLocation::kSideCollection) { operation.setNeedsRetryImage(repl::RetryImageEnum::kPreImage); } } } - - if (args.changeStreamPreAndPostImagesEnabledForCollection) { - tassert(5869400, - "Deleted document must be present for pre-image recording", - args.deletedDoc); - tassert( - 5869401, - "Change stream pre-image recording to the oplog and to the pre-image collection " - "requested at the same time", - !args.preImageRecordingEnabledForCollection); - operation.setPreImage(args.deletedDoc->getOwned()); - operation.setChangeStreamPreImageRecordingMode( - ChangeStreamPreImageRecordingMode::kPreImagesCollection); - } else if (args.preImageRecordingEnabledForCollection) { + if (args.preImageRecordingEnabledForCollection) { tassert(5868701, "Deleted document must be present for pre-image recording", args.deletedDoc); operation.setPreImage(args.deletedDoc->getOwned()); - operation.setChangeStreamPreImageRecordingMode( - ChangeStreamPreImageRecordingMode::kOplog); } operation.setDestinedRecipient(destinedRecipientDecoration(opCtx)); @@ -1288,38 +1251,6 @@ void OpObserverImpl::onEmptyCapped(OperationContext* opCtx, } namespace { - -/** - * Writes pre-images for update/replace/delete operations packed into a single "applyOps" entry to - * the change stream pre-images collection if required. The operations are defined by sequence - * ['stmtBegin', 'stmtEnd'). 'applyOpsTimestamp' and 'operationTime' are the timestamp and the wall - * clock time, respectively, of the "applyOps" entry. A pre-image is recorded for an operation only - * if pre-images are enabled for the collection the operation is issued on. - */ -void writeChangeStreamPreImagesForApplyOpsEntries( - OperationContext* opCtx, - const std::vector<repl::ReplOperation>::iterator& stmtBegin, - const std::vector<repl::ReplOperation>::iterator& stmtEnd, - Timestamp applyOpsTimestamp, - Date_t operationTime) { - int64_t applyOpsIndex{0}; - for (auto stmtIterator = stmtBegin; stmtIterator != stmtEnd; ++stmtIterator) { - auto& operation = *stmtIterator; - if (operation.isChangeStreamPreImageRecordedInPreImagesCollection() && - !operation.getNss().isTemporaryReshardingCollection()) { - invariant(operation.getUuid()); - invariant(!operation.getPreImage().isEmpty()); - writeToChangeStreamPreImagesCollection( - opCtx, - ChangeStreamPreImage{ - ChangeStreamPreImageId{*operation.getUuid(), applyOpsTimestamp, applyOpsIndex}, - operationTime, - operation.getPreImage()}); - } - ++applyOpsIndex; - } -} - // Accepts an empty BSON builder and appends the given transaction statements to an 'applyOps' array // field. Appends as many operations as possible to the array (and their corresponding statement // ids to 'stmtIdsWritten') until either the constructed object exceeds the 16MB limit or the @@ -1517,11 +1448,8 @@ int logOplogEntriesForTransaction( if (numberOfPrePostImagesToWrite > 0 && !migrationRecipientInfo) { for (auto& statement : *stmts) { - if (statement.isChangeStreamPreImageRecordedInOplog() || - (statement.isPreImageRecordedForRetryableInternalTransaction() && - statement.getNeedsRetryImage() != repl::RetryImageEnum::kPreImage)) { - invariant(!statement.getPreImage().isEmpty()); - + if (!statement.getPreImage().isEmpty() && + statement.getNeedsRetryImage() != repl::RetryImageEnum::kPreImage) { // Note that 'needsRetryImage' stores the image kind that needs to stored in the // image collection. Therefore, when 'needsRetryImage' is equal to kPreImage, the // pre-image will be written to the image collection (after all the applyOps oplog @@ -1645,10 +1573,6 @@ int logOplogEntriesForTransaction( prevWriteOpTime.writeOpTime.getTimestamp()}; } - const auto applyOpsEntryTimestamp = prevWriteOpTime.writeOpTime.getTimestamp(); - writeChangeStreamPreImagesForApplyOpsEntries( - opCtx, stmtsIter, nextStmt, applyOpsEntryTimestamp, oplogEntry.getWallClockTime()); - // Advance the iterator to the beginning of the remaining unpacked statements. stmtsIter = nextStmt; numEntriesWritten++; @@ -1702,7 +1626,7 @@ void logCommitOrAbortForPreparedTransaction(OperationContext* opCtx, }); } -} // namespace +} // namespace void OpObserverImpl::onUnpreparedTransactionCommit(OperationContext* opCtx, std::vector<repl::ReplOperation>* statements, diff --git a/src/mongo/db/pipeline/change_stream_pre_image_helpers.cpp b/src/mongo/db/pipeline/change_stream_pre_image_helpers.cpp index 3bdbf3954c5..68e2e6949f8 100644 --- a/src/mongo/db/pipeline/change_stream_pre_image_helpers.cpp +++ b/src/mongo/db/pipeline/change_stream_pre_image_helpers.cpp @@ -44,10 +44,6 @@ namespace mongo { void writeToChangeStreamPreImagesCollection(OperationContext* opCtx, const ChangeStreamPreImage& preImage) { const auto collectionNamespace = NamespaceString::kChangeStreamPreImagesNamespace; - tassert(5869404, - str::stream() << "Invalid pre-image document applyOpsIndex: " - << preImage.getId().getApplyOpsIndex(), - preImage.getId().getApplyOpsIndex() >= 0); // This lock acquisition can block on a stronger lock held by another operation modifying the // pre-images collection. There are no known cases where an operation holding an exclusive lock @@ -56,9 +52,7 @@ void writeToChangeStreamPreImagesCollection(OperationContext* opCtx, AutoGetCollection preimagesCollectionRaii(opCtx, collectionNamespace, LockMode::MODE_IX); UpdateResult res = Helpers::upsert(opCtx, collectionNamespace.toString(), preImage.toBSON()); tassert(5868601, - str::stream() << "Failed to insert a new document into the pre-images collection: ts: " - << preImage.getId().getTs().toString() - << ", applyOpsIndex: " << preImage.getId().getApplyOpsIndex(), + "Failed to insert a new document into pre-images collection", !res.existing && !res.upsertedId.isEmpty()); } } // namespace mongo diff --git a/src/mongo/db/pipeline/document_source_change_stream.h b/src/mongo/db/pipeline/document_source_change_stream.h index efe83289131..773b13c1050 100644 --- a/src/mongo/db/pipeline/document_source_change_stream.h +++ b/src/mongo/db/pipeline/document_source_change_stream.h @@ -174,7 +174,6 @@ public: static constexpr StringData kLsidField = "lsid"_sd; static constexpr StringData kTxnOpIndexField = "txnOpIndex"_sd; static constexpr StringData kApplyOpsIndexField = "applyOpsIndex"_sd; - static constexpr StringData kApplyOpsTsField = "applyOpsTs"_sd; static constexpr StringData kRawOplogUpdateSpecField = "rawOplogUpdateSpec"_sd; // The target namespace of a rename operation. diff --git a/src/mongo/db/pipeline/document_source_change_stream_transform.cpp b/src/mongo/db/pipeline/document_source_change_stream_transform.cpp index b59348fc4e5..148e0c9a385 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_transform.cpp +++ b/src/mongo/db/pipeline/document_source_change_stream_transform.cpp @@ -350,7 +350,6 @@ Document DocumentSourceChangeStreamTransform::applyTransformation(const Document // unwinding a transaction. auto txnOpIndex = input[DocumentSourceChangeStream::kTxnOpIndexField]; auto applyOpsIndex = input[DocumentSourceChangeStream::kApplyOpsIndexField]; - auto applyOpsEntryTs = input[DocumentSourceChangeStream::kApplyOpsTsField]; // Add some additional fields only relevant to transactions. if (!txnOpIndex.missing()) { @@ -406,10 +405,10 @@ Document DocumentSourceChangeStreamTransform::applyTransformation(const Document } else { // Set 'kPreImageIdField' to the 'ChangeStreamPreImageId'. The DSCSAddPreImage stage // will use the id in order to fetch the pre-image from the pre-images collection. - const auto preImageId = ChangeStreamPreImageId( - uuid.getUuid(), - applyOpsEntryTs.missing() ? ts.getTimestamp() : applyOpsEntryTs.getTimestamp(), - applyOpsIndex.missing() ? 0 : applyOpsIndex.getLong()); + const auto preImageId = + ChangeStreamPreImageId(uuid.getUuid(), + ts.getTimestamp(), + applyOpsIndex.missing() ? 0 : applyOpsIndex.getLong()); doc.addField(DocumentSourceChangeStream::kPreImageIdField, Value(preImageId.toBSON())); } } @@ -448,10 +447,9 @@ DepsTracker::State DocumentSourceChangeStreamTransform::getDependencies(DepsTrac deps->fields.insert(repl::OplogEntry::kTxnNumberFieldName.toString()); deps->fields.insert(DocumentSourceChangeStream::kTxnOpIndexField.toString()); - if (_preImageRequested || _postImageRequested) { + if (_preImageRequested) { deps->fields.insert(repl::OplogEntry::kPreImageOpTimeFieldName.toString()); deps->fields.insert(DocumentSourceChangeStream::kApplyOpsIndexField.toString()); - deps->fields.insert(DocumentSourceChangeStream::kApplyOpsTsField.toString()); } return DepsTracker::State::EXHAUSTIVE_ALL; } diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp index cdd07aa79b9..8e51e29e7b9 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp +++ b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.cpp @@ -268,7 +268,6 @@ DocumentSourceChangeStreamUnwindTransaction::TransactionOpIterator::TransactionO // Initialize iterators at the beginning of the transaction. _currentApplyOpsIt = _currentApplyOps.getArray().begin(); - _currentApplyOpsTs = firstTimestamp.getTimestamp(); _currentApplyOpsIndex = 0; _txnOpIndex = 0; } @@ -305,7 +304,6 @@ DocumentSourceChangeStreamUnwindTransaction::TransactionOpIterator::getNextTrans BSONType::Array == bsonOp["applyOps"].type()); _currentApplyOps = Value(bsonOp["applyOps"]); - _currentApplyOpsTs = applyOpsEntry.getTimestamp(); _currentApplyOpsIt = _currentApplyOps.getArray().begin(); _currentApplyOpsIndex = 0; } @@ -340,7 +338,6 @@ DocumentSourceChangeStreamUnwindTransaction::TransactionOpIterator::_addRequired // the current entry. newDoc.addField(DocumentSourceChangeStream::kApplyOpsIndexField, Value(static_cast<long long>(applyOpsIndex()))); - newDoc.addField(DocumentSourceChangeStream::kApplyOpsTsField, Value(applyOpsTs())); newDoc.addField(repl::OplogEntry::kTimestampFieldName, Value(_clusterTime)); newDoc.addField(repl::OplogEntry::kSessionIdFieldName, Value(_lsid)); diff --git a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h index f2b17259980..a2659178d6b 100644 --- a/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h +++ b/src/mongo/db/pipeline/document_source_change_stream_unwind_transaction.h @@ -133,15 +133,6 @@ private: return _currentApplyOpsIndex - 1; } - /** - * Returns the timestamp of the "applyOps" entry containing the last operation returned by - * 'getNextTransactionOp()'. If 'getNextTransactionOp()' has not been called, returns the - * timestamp of the first "applyOps" entry in the transaction. - */ - Timestamp applyOpsTs() const { - return _currentApplyOpsTs; - } - Timestamp clusterTime() const { return _clusterTime; } @@ -203,9 +194,6 @@ private: // The index of the next entry within the current 'applyOps' array. size_t _currentApplyOpsIndex; - // The timestamp of the current 'applyOps' entry. - Timestamp _currentApplyOpsTs; - // Our current place within the entire transaction, which may consist of multiple 'applyOps' // arrays. size_t _txnOpIndex; diff --git a/src/mongo/db/repl/apply_ops_command_info.cpp b/src/mongo/db/repl/apply_ops_command_info.cpp index 16057086653..ced7b83b770 100644 --- a/src/mongo/db/repl/apply_ops_command_info.cpp +++ b/src/mongo/db/repl/apply_ops_command_info.cpp @@ -130,7 +130,6 @@ void ApplyOps::extractOperationsTo(const OplogEntry& applyOpsOplogEntry, auto operationDocs = info.getOperations(); bool alwaysUpsert = info.getAlwaysUpsert() && !applyOpsOplogEntry.getTxnNumber(); - uint64_t applyOpsIdx{0}; for (const auto& operationDoc : operationDocs) { // Make sure that the inner ops are not malformed or over-specified. ReplOperation::parse(IDLParserErrorContext("extractOperations"), operationDoc); @@ -146,19 +145,11 @@ void ApplyOps::extractOperationsTo(const OplogEntry& applyOpsOplogEntry, builder.appendElementsUnique(topLevelDoc); auto operation = builder.obj(); - operations->emplace_back(operation); - - // Preserve index of operation in the "applyOps" oplog entry, timestamp, and wall clock time - // of the "applyOps" entry. - auto& lastOperation = operations->back(); - lastOperation.setApplyOpsIndex(applyOpsIdx); - lastOperation.setApplyOpsTimestamp(applyOpsOplogEntry.getTimestamp()); - lastOperation.setApplyOpsWallClockTime(applyOpsOplogEntry.getWallClockTime()); - ++applyOpsIdx; - - if (lastOperation.getNeedsRetryImage()) { - lastOperation.setTimestampForRetryImage(applyOpsOplogEntry.getTimestamp()); + OplogEntry oplogEntry{operation}; + if (oplogEntry.getNeedsRetryImage()) { + oplogEntry.setTimestampForRetryImage(applyOpsOplogEntry.getTimestamp()); } + operations->emplace_back(std::move(oplogEntry)); } } diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index f307741e720..0030db48c13 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -1084,11 +1084,10 @@ void writeChangeStreamPreImage(OperationContext* opCtx, const CollectionPtr& collection, const mongo::repl::OplogEntry& oplogEntry, const BSONObj& preImage) { - ChangeStreamPreImageId preImageId{collection->uuid(), - oplogEntry.getTimestampForPreImage(), - static_cast<int64_t>(oplogEntry.getApplyOpsIndex())}; + ChangeStreamPreImageId preImageId{ + collection->uuid(), oplogEntry.getTimestamp(), 0 /*applyOpsIndex*/}; ChangeStreamPreImage preImageDocument{ - std::move(preImageId), oplogEntry.getWallClockTimeForPreImage(), preImage}; + std::move(preImageId), oplogEntry.getWallClockTime(), preImage}; writeToChangeStreamPreImagesCollection(opCtx, preImageDocument); } } // namespace @@ -1740,11 +1739,7 @@ Status applyOperation_inlock(OperationContext* opCtx, writeChangeStreamPreImage(opCtx, collection, op, *(result.requestedPreImage)); } - // It is legal for a delete operation on the pre-images collection to delete zero - // documents - pre-image collections are not guaranteed to contain the same set of - // documents at all times. - if (result.nDeleted == 0 && mode == OplogApplication::Mode::kSecondary && - !requestNss.isChangeStreamPreImagesCollection()) { + if (result.nDeleted == 0 && mode == OplogApplication::Mode::kSecondary) { LOGV2_WARNING(2170002, "Applied a delete which did not delete anything in steady state " "replication", diff --git a/src/mongo/db/repl/oplog_entry.cpp b/src/mongo/db/repl/oplog_entry.cpp index 093c4b6620a..ece6da5d3ee 100644 --- a/src/mongo/db/repl/oplog_entry.cpp +++ b/src/mongo/db/repl/oplog_entry.cpp @@ -736,37 +736,6 @@ bool OplogEntry::isSingleOplogEntryTransactionWithCommand() const { return _entry.isSingleOplogEntryTransactionWithCommand(); } -uint64_t OplogEntry::getApplyOpsIndex() const { - return _applyOpsIndex; -} - -void OplogEntry::setApplyOpsIndex(uint64_t value) { - _applyOpsIndex = value; -} - -const boost::optional<mongo::Timestamp>& OplogEntry::getApplyOpsTimestamp() const { - return _applyOpsTimestamp; -} - -void OplogEntry::setApplyOpsTimestamp(boost::optional<mongo::Timestamp> value) { - _applyOpsTimestamp = value; -} - -const boost::optional<mongo::Date_t>& OplogEntry::getApplyOpsWallClockTime() const { - return _applyOpsWallClockTime; -} -void OplogEntry::setApplyOpsWallClockTime(boost::optional<mongo::Date_t> value) { - _applyOpsWallClockTime = value; -} - -mongo::Timestamp OplogEntry::getTimestampForPreImage() const { - return getApplyOpsTimestamp().get_value_or(getTimestamp()); -} - -mongo::Date_t OplogEntry::getWallClockTimeForPreImage() const { - return getApplyOpsWallClockTime().get_value_or(getWallClockTime()); -} - bool OplogEntry::isCrudOpType() const { return _entry.isCrudOpType(); } diff --git a/src/mongo/db/repl/oplog_entry.h b/src/mongo/db/repl/oplog_entry.h index 29e8a0a71d9..8cfdf210ca9 100644 --- a/src/mongo/db/repl/oplog_entry.h +++ b/src/mongo/db/repl/oplog_entry.h @@ -68,20 +68,6 @@ constexpr auto kInitiatingSetMsg = "initiating set"_sd; class ReplOperation : public DurableReplOperation { public: - /** - * The way the change stream pre-images are recorded upon update/replace/delete operation. - */ - enum class ChangeStreamPreImageRecordingMode { - // The pre-image is not recorded. - kOff, - - // The pre-image is recorded in the change stream pre-images collection. - kPreImagesCollection, - - // The pre-image is recorded in the oplog as a separate entry. - kOplog, - }; - static ReplOperation parse(const IDLParserErrorContext& ctxt, const BSONObj& bsonObject) { ReplOperation o; o.parseProtected(ctxt, bsonObject); @@ -123,54 +109,6 @@ public: } /** - * Returns the change stream pre-images recording mode applied for this operation. - */ - ChangeStreamPreImageRecordingMode getChangeStreamPreImageRecordingMode() const { - return _preImageRecordingMode; - } - - /** - * Sets the change stream pre-images recording mode to apply for this operation. - */ - void setChangeStreamPreImageRecordingMode(ChangeStreamPreImageRecordingMode value) { - _preImageRecordingMode = value; - } - - /** - * Returns true if the change stream pre-image is recorded in a dedicated oplog entry for this - * operation. - */ - bool isChangeStreamPreImageRecordedInOplog() const { - return ReplOperation::ChangeStreamPreImageRecordingMode::kOplog == - getChangeStreamPreImageRecordingMode(); - } - - /** - * Returns true if the change stream pre-image is recorded in the change stream pre-images - * collection for this operation. - */ - bool isChangeStreamPreImageRecordedInPreImagesCollection() const { - return ReplOperation::ChangeStreamPreImageRecordingMode::kPreImagesCollection == - getChangeStreamPreImageRecordingMode(); - } - - /** - * Returns true if the operation is in a retryable internal transaction and pre-image must be - * recorded for the operation. - */ - bool isPreImageRecordedForRetryableInternalTransaction() const { - return _preImageRecordedForRetryableInternalTransaction; - } - - /** - * Sets whether the operation is in a retryable internal transaction and pre-image must be - * recorded for the operation. - */ - void setPreImageRecordedForRetryableInternalTransaction(bool value = true) { - _preImageRecordedForRetryableInternalTransaction = value; - } - - /** * Sets the statement ids for this ReplOperation to 'stmtIds' if it does not contain any * kUninitializedStmtId (i.e. placeholder statement id). */ @@ -196,14 +134,6 @@ private: // the images should be persisted. BSONObj _fullPreImage; BSONObj _fullPostImage; - - // Change stream pre-image recording mode applied to this operation. - ChangeStreamPreImageRecordingMode _preImageRecordingMode{ - ChangeStreamPreImageRecordingMode::kOff}; - - // Whether a pre-image must be recorded for this operation since it is in a retryable internal - // transaction. - bool _preImageRecordedForRetryableInternalTransaction{false}; }; /** @@ -707,46 +637,6 @@ public: bool isTerminalApplyOps() const; bool isSingleOplogEntryTransaction() const; bool isSingleOplogEntryTransactionWithCommand() const; - - /** - * Returns an index of this operation in the "applyOps" entry, if the operation is packed in the - * "applyOps" entry. Otherwise returns 0. - */ - uint64_t getApplyOpsIndex() const; - - void setApplyOpsIndex(uint64_t value); - - /** - * Returns a timestamp of the "applyOps" entry, if this operation is packed in the "applyOps" - * entry. Otherwise returns boost::none. - */ - const boost::optional<mongo::Timestamp>& getApplyOpsTimestamp() const; - - void setApplyOpsTimestamp(boost::optional<mongo::Timestamp> value); - - /** - * Returns wall clock time of the "applyOps" entry, if this operation is packed in the - * "applyOps" entry. Otherwise returns boost::none. - */ - const boost::optional<mongo::Date_t>& getApplyOpsWallClockTime() const; - - void setApplyOpsWallClockTime(boost::optional<mongo::Date_t> value); - - /** - * Returns a timestamp to use for recording of a change stream pre-image in the change stream - * pre-images collection. Returns a timestamp of the "applyOps" entry, if this operation is - * packed in the "applyOps" entry. Otherwise returns a timestamp of this oplog entry. - */ - mongo::Timestamp getTimestampForPreImage() const; - - /** - * Returns a wall clock time to use for recording of a change stream pre-image in the change - * stream pre-images collection. Returns a wall clock time of the "applyOps" entry, if this - * operation is packed in the "applyOps" entry. Otherwise returns a wall clock time of this - * oplog entry. - */ - mongo::Date_t getWallClockTimeForPreImage() const; - bool isCrudOpType() const; bool isUpdateOrDelete() const; bool isIndexCommandType() const; @@ -766,18 +656,6 @@ private: std::shared_ptr<DurableOplogEntry> _preImageOp; std::shared_ptr<DurableOplogEntry> _postImageOp; - // An index of this oplog entry in the associated "applyOps" oplog entry when this entry is - // extracted from an "applyOps" oplog entry. Otherwise, the index value must be 0. - uint64_t _applyOpsIndex{0}; - - // A timestamp of the associated "applyOps" oplog entry when this oplog entry is extracted from - // an "applyOps" oplog entry. - boost::optional<Timestamp> _applyOpsTimestamp{boost::none}; - - // Wall clock time of the associated "applyOps" oplog entry when this oplog entry is extracted - // from an "applyOps" oplog entry. - boost::optional<Date_t> _applyOpsWallClockTime{boost::none}; - bool _isForCappedCollection = false; // During oplog application on secondaries, oplog entries extracted from each applyOps oplog diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp index 6b656bfd97b..21d2d8b92b9 100644 --- a/src/mongo/db/transaction_participant.cpp +++ b/src/mongo/db/transaction_participant.cpp @@ -1673,10 +1673,7 @@ void TransactionParticipant::Participant::addTransactionOperation( repl::DurableOplogEntry::getDurableReplOperationSize(operation); if (!operation.getPreImage().isEmpty()) { p().transactionOperationBytes += operation.getPreImage().objsize(); - if (operation.isChangeStreamPreImageRecordedInOplog() || - operation.isPreImageRecordedForRetryableInternalTransaction()) { - ++p().numberOfPrePostImagesToWrite; - } + ++p().numberOfPrePostImagesToWrite; } if (!operation.getPostImage().isEmpty()) { p().transactionOperationBytes += operation.getPostImage().objsize(); |