summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/oplog.cpp
diff options
context:
space:
mode:
authorjannaerin <golden.janna@gmail.com>2021-02-22 22:40:23 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-22 21:35:26 +0000
commitf25c2c9cfbb0e4ae20cd080b3b79a505308db175 (patch)
treec7ea4b97d7d09961438f57c746bcf8922738dc0a /src/mongo/db/repl/oplog.cpp
parent2e11c995441e7490a9da9891ff6acc6f84a8163b (diff)
downloadmongo-f25c2c9cfbb0e4ae20cd080b3b79a505308db175.tar.gz
SERVER-53679 No-op for filling in destined recipient for insert oplog entries adds overhead on shardsvrs not running resharding
Diffstat (limited to 'src/mongo/db/repl/oplog.cpp')
-rw-r--r--src/mongo/db/repl/oplog.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp
index 6fa8771aa5f..39036b900f8 100644
--- a/src/mongo/db/repl/oplog.cpp
+++ b/src/mongo/db/repl/oplog.cpp
@@ -417,10 +417,12 @@ OpTime logOp(OperationContext* opCtx, MutableOplogEntry* oplogEntry) {
return slot;
}
-std::vector<OpTime> logInsertOps(OperationContext* opCtx,
- MutableOplogEntry* oplogEntryTemplate,
- std::vector<InsertStatement>::const_iterator begin,
- std::vector<InsertStatement>::const_iterator end) {
+std::vector<OpTime> logInsertOps(
+ OperationContext* opCtx,
+ MutableOplogEntry* oplogEntryTemplate,
+ std::vector<InsertStatement>::const_iterator begin,
+ std::vector<InsertStatement>::const_iterator end,
+ std::function<boost::optional<ShardId>(const BSONObj& doc)> getDestinedRecipientFn) {
invariant(begin != end);
oplogEntryTemplate->setOpType(repl::OpTypeEnum::kInsert);
// If this oplog entry is from a tenant migration, include the tenant migration
@@ -464,7 +466,7 @@ std::vector<OpTime> logInsertOps(OperationContext* opCtx,
}
oplogEntry.setObject(begin[i].doc);
oplogEntry.setOpTime(insertStatementOplogSlot);
- oplogEntry.setDestinedRecipient(getDestinedRecipient(opCtx, nss, begin[i].doc));
+ oplogEntry.setDestinedRecipient(getDestinedRecipientFn(begin[i].doc));
addDestinedRecipient.execute([&](const BSONObj& data) {
auto recipient = data["destinedRecipient"].String();
oplogEntry.setDestinedRecipient(boost::make_optional<ShardId>({recipient}));