summaryrefslogtreecommitdiff
path: root/src/mongo/db/update/update_driver.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/update/update_driver.cpp')
-rw-r--r--src/mongo/db/update/update_driver.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/mongo/db/update/update_driver.cpp b/src/mongo/db/update/update_driver.cpp
index 5ce9dc8aa84..9839487da9d 100644
--- a/src/mongo/db/update/update_driver.cpp
+++ b/src/mongo/db/update/update_driver.cpp
@@ -159,7 +159,14 @@ void UpdateDriver::parse(
"multi update is not supported for replacement-style update",
!multi);
- _updateExecutor = std::make_unique<ObjectReplaceExecutor>(updateMod.getUpdateReplacement());
+ // For updates that originated from the oplog, we're required to apply the update
+ // exactly as it was recorded (even if it contains zero-valued timestamps). Therefore,
+ // we should only replace zero-valued timestamps with the current time when both
+ // '_bypassEmptyTsReplacement' and '_fromOplogApplication' are false.
+ const bool bypassEmptyTsReplacement = _bypassEmptyTsReplacement || _fromOplogApplication;
+
+ _updateExecutor = std::make_unique<ObjectReplaceExecutor>(updateMod.getUpdateReplacement(),
+ bypassEmptyTsReplacement);
// Register the fact that this driver will only do full object replacements.
_updateType = UpdateType::kReplacement;