From d78928f90492739ce5401d112b0fe89e278d3954 Mon Sep 17 00:00:00 2001 From: Jason Chan Date: Mon, 17 May 2021 10:21:05 -0400 Subject: SERVER-56630 Unittest OpObserverImpl and chunk migration for retryable findAndModify --- src/mongo/db/repl/oplog_entry.cpp | 13 ++++++++++--- src/mongo/db/repl/oplog_entry.h | 3 ++- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/mongo/db/repl') diff --git a/src/mongo/db/repl/oplog_entry.cpp b/src/mongo/db/repl/oplog_entry.cpp index cb8d538b65c..b0e7ec88c7c 100644 --- a/src/mongo/db/repl/oplog_entry.cpp +++ b/src/mongo/db/repl/oplog_entry.cpp @@ -94,7 +94,8 @@ BSONObj makeOplogEntryDoc(OpTime opTime, const boost::optional& statementId, const boost::optional& prevWriteOpTimeInTransaction, const boost::optional& preImageOpTime, - const boost::optional& postImageOpTime) { + const boost::optional& postImageOpTime, + const boost::optional& needsRetryImage) { BSONObjBuilder builder; sessionInfo.serialize(&builder); builder.append(OplogEntryBase::kTimestampFieldName, opTime.getTimestamp()); @@ -135,6 +136,10 @@ BSONObj makeOplogEntryDoc(OpTime opTime, const BSONObj localObject = postImageOpTime.get().toBSON(); builder.append(OplogEntryBase::kPostImageOpTimeFieldName, localObject); } + if (needsRetryImage) { + builder.append(OplogEntryBase::kNeedsRetryImageFieldName, + RetryImage_serializer(needsRetryImage.get())); + } return builder.obj(); } @@ -219,7 +224,8 @@ OplogEntry::OplogEntry(OpTime opTime, const boost::optional& statementId, const boost::optional& prevWriteOpTimeInTransaction, const boost::optional& preImageOpTime, - const boost::optional& postImageOpTime) + const boost::optional& postImageOpTime, + const boost::optional& needsRetryImage) : OplogEntry(makeOplogEntryDoc(opTime, hash, opType, @@ -235,7 +241,8 @@ OplogEntry::OplogEntry(OpTime opTime, statementId, prevWriteOpTimeInTransaction, preImageOpTime, - postImageOpTime)) {} + postImageOpTime, + needsRetryImage)) {} bool OplogEntry::isCommand() const { return getOpType() == OpTypeEnum::kCommand; diff --git a/src/mongo/db/repl/oplog_entry.h b/src/mongo/db/repl/oplog_entry.h index f89016e8bc3..99b974a226b 100644 --- a/src/mongo/db/repl/oplog_entry.h +++ b/src/mongo/db/repl/oplog_entry.h @@ -100,7 +100,8 @@ public: const boost::optional& statementId, const boost::optional& prevWriteOpTimeInTransaction, const boost::optional& preImageOpTime, - const boost::optional& postImageOpTime); + const boost::optional& postImageOpTime, + const boost::optional& needsRetryImage = boost::none); // DEPRECATED: This constructor can throw. Use static parse method instead. explicit OplogEntry(BSONObj raw); -- cgit v1.2.1