diff options
author | Andrew Shuvalov <andrew.shuvalov@mongodb.com> | 2021-05-19 19:40:39 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-05-19 20:04:29 +0000 |
commit | 55499d373701e0dbc8d7c96935290ac08900ea07 (patch) | |
tree | e4836ad48fac3f63e06a145b49750758379d59d8 /src/mongo/db/repl/oplog.cpp | |
parent | a510e9ff4d9694663356e408999e33dbf76e70f3 (diff) | |
download | mongo-55499d373701e0dbc8d7c96935290ac08900ea07.tar.gz |
SERVER-56373: BACKPORT-8899 from 8447dea added needsRetryImage support to log serializer for oplog
Diffstat (limited to 'src/mongo/db/repl/oplog.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 7dc0d5e6b85..04b693f8285 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -380,7 +380,8 @@ OplogDocWriter _logOpWriter(OperationContext* opCtx, Date_t wallTime, const OperationSessionInfo& sessionInfo, boost::optional<StmtId> statementId, - const OplogLink& oplogLink) { + const OplogLink& oplogLink, + boost::optional<repl::RetryImageEnum> needsRetryImage) { BSONObjBuilder b(256); b.append("ts", optime.getTimestamp()); @@ -402,6 +403,10 @@ OplogDocWriter _logOpWriter(OperationContext* opCtx, if (o2) b.append("o2", *o2); + if (needsRetryImage) { + b.append("needsRetryImage", repl::RetryImage_serializer(*needsRetryImage)); + } + invariant(wallTime != Date_t{}); b.appendDate(OplogEntryBase::kWallClockTimeFieldName, wallTime); @@ -490,7 +495,8 @@ OpTime logOp(OperationContext* opCtx, const OperationSessionInfo& sessionInfo, boost::optional<StmtId> statementId, const OplogLink& oplogLink, - const OplogSlot& oplogSlot) { + const OplogSlot& oplogSlot, + boost::optional<repl::RetryImageEnum> needsRetryImage) { // All collections should have UUIDs now, so all insert, update, and delete oplog entries should // also have uuids. Some no-op (n) and command (c) entries may still elide the uuid field. invariant(uuid || 'n' == *opstr || 'c' == *opstr, @@ -539,7 +545,8 @@ OpTime logOp(OperationContext* opCtx, wallClockTime, sessionInfo, statementId, - oplogLink); + oplogLink, + needsRetryImage); const DocWriter* basePtr = &writer; auto timestamp = slot.getTimestamp(); _logOpsInner(opCtx, nss, &basePtr, ×tamp, 1, oplog, slot, wallClockTime); @@ -610,7 +617,8 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx, wallClockTime, sessionInfo, begin[i].stmtId, - oplogLink)); + oplogLink, + {})); oplogLink.prevOpTime = insertStatementOplogSlot; timestamps[i] = oplogLink.prevOpTime.getTimestamp(); opTimes.push_back(insertStatementOplogSlot); |