diff options
author | Dan Larkin-York <dan.larkin-york@mongodb.com> | 2021-04-28 21:04:54 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-04-28 22:07:09 +0000 |
commit | 09e418805e9019cb56e54d240c7c7d9bcb95e339 (patch) | |
tree | 9c0f988d9b9bdfa0b808b84849d1c8b87497bcc6 /src/mongo/db/repl/oplog.cpp | |
parent | 6e88994a34e7882e1c9692fea653ed625e6e1c1b (diff) | |
download | mongo-09e418805e9019cb56e54d240c7c7d9bcb95e339.tar.gz |
SERVER-55501 Avoid element-wise iteration and copy when appending to an object in doc_diff::applyDiff
Diffstat (limited to 'src/mongo/db/repl/oplog.cpp')
-rw-r--r-- | src/mongo/db/repl/oplog.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/db/repl/oplog.cpp b/src/mongo/db/repl/oplog.cpp index 33d35adb97f..996f3bbcc4d 100644 --- a/src/mongo/db/repl/oplog.cpp +++ b/src/mongo/db/repl/oplog.cpp @@ -1364,7 +1364,17 @@ Status applyOperation_inlock(OperationContext* opCtx, auto request = UpdateRequest(); request.setNamespaceString(requestNss); request.setQuery(updateCriteria); - auto updateMod = write_ops::UpdateModification::parseFromOplogEntry(o); + // If we are in steady state and the update is on a timeseries bucket collection, we can + // enable some optimizations in diff application. In some cases, during tenant + // migration, we can for some reason generate entries for timeseries bucket collections + // which still rely on the idempotency guarantee, which then means we shouldn't apply + // these optimizations. + write_ops::UpdateModification::DiffOptions options; + if (mode == OplogApplication::Mode::kSecondary && collection->getTimeseriesOptions() && + !op.getFromTenantMigration()) { + options.mustCheckExistenceForInsertOperations = false; + } + auto updateMod = write_ops::UpdateModification::parseFromOplogEntry(o, options); // TODO SERVER-51075: Remove FCV checks for $v:2 delta oplog entries. if (updateMod.type() == write_ops::UpdateModification::Type::kDelta) { |