summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
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
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')
-rw-r--r--src/mongo/db/repl/oplog.cpp12
-rw-r--r--src/mongo/db/repl/oplog.h10
2 files changed, 13 insertions, 9 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}));
diff --git a/src/mongo/db/repl/oplog.h b/src/mongo/db/repl/oplog.h
index 346b1072188..37b9f29fd98 100644
--- a/src/mongo/db/repl/oplog.h
+++ b/src/mongo/db/repl/oplog.h
@@ -131,10 +131,12 @@ void createOplog(OperationContext* opCtx);
* defined by the begin-end range.
*
*/
-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);
/**
* Returns the optime of the oplog entry written to the oplog.