summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorJason Chan <jason.chan@10gen.com>2021-05-17 10:21:05 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-05-18 15:28:01 +0000
commitd78928f90492739ce5401d112b0fe89e278d3954 (patch)
treecde536dbf93e00f565c5dca756437d98af0e8a0a /src/mongo/db/repl
parentd1ae2767df71fe5f941447b299ac6d1383ec02a9 (diff)
downloadmongo-d78928f90492739ce5401d112b0fe89e278d3954.tar.gz
SERVER-56630 Unittest OpObserverImpl and chunk migration for retryable findAndModify
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/oplog_entry.cpp13
-rw-r--r--src/mongo/db/repl/oplog_entry.h3
2 files changed, 12 insertions, 4 deletions
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<StmtId>& statementId,
const boost::optional<OpTime>& prevWriteOpTimeInTransaction,
const boost::optional<OpTime>& preImageOpTime,
- const boost::optional<OpTime>& postImageOpTime) {
+ const boost::optional<OpTime>& postImageOpTime,
+ const boost::optional<repl::RetryImageEnum>& 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<StmtId>& statementId,
const boost::optional<OpTime>& prevWriteOpTimeInTransaction,
const boost::optional<OpTime>& preImageOpTime,
- const boost::optional<OpTime>& postImageOpTime)
+ const boost::optional<OpTime>& postImageOpTime,
+ const boost::optional<repl::RetryImageEnum>& 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<StmtId>& statementId,
const boost::optional<OpTime>& prevWriteOpTimeInTransaction,
const boost::optional<OpTime>& preImageOpTime,
- const boost::optional<OpTime>& postImageOpTime);
+ const boost::optional<OpTime>& postImageOpTime,
+ const boost::optional<repl::RetryImageEnum>& needsRetryImage = boost::none);
// DEPRECATED: This constructor can throw. Use static parse method instead.
explicit OplogEntry(BSONObj raw);