summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog.cpp
diff options
context:
space:
mode:
authorRui Liu <rui.liu@mongodb.com>2022-01-11 12:35:12 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-01-11 13:30:03 +0000
commitf9c396ab21eb033388a86bd494429966eb138208 (patch)
tree1e12041ba0cb7b4141658558d447252ea50fcd79 /src/mongo/db/repl/oplog.cpp
parent204d6eed96ed5151b1d11b22d128d923b452833f (diff)
downloadmongo-f9c396ab21eb033388a86bd494429966eb138208.tar.gz
SERVER-61891 Add document key to insert log entry
Diffstat (limited to 'src/mongo/db/repl/oplog.cpp')
-rw-r--r--src/mongo/db/repl/oplog.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 5454baf2abd..ea9b83dc41b 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -73,6 +73,7 @@
#include "mongo/db/keypattern.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/op_observer.h"
+#include "mongo/db/op_observer_util.h"
#include "mongo/db/ops/delete.h"
#include "mongo/db/ops/delete_request_gen.h"
#include "mongo/db/ops/update.h"
@@ -521,7 +522,9 @@ std::vector<OpTime> logInsertOps(
if (insertStatementOplogSlot.isNull()) {
insertStatementOplogSlot = oplogInfo->getNextOpTimes(opCtx, 1U)[0];
}
+ const auto docKey = getDocumentKey(opCtx, nss, begin[i].doc).getShardKeyAndId();
oplogEntry.setObject(begin[i].doc);
+ oplogEntry.setObject2(docKey);
oplogEntry.setOpTime(insertStatementOplogSlot);
oplogEntry.setDestinedRecipient(getDestinedRecipientFn(begin[i].doc));
addDestinedRecipient.execute([&](const BSONObj& data) {