summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops/insert.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-18 17:02:53 -0300
commit959575a5ca598bf5f37fb5cebe7ed1d80d3d71f7 (patch)
treeacc8d60aedb12b70048e676e8a7349deb0010db8 /src/mongo/db/ops/insert.cpp
parent76588293975fc059cf076779e4283e6ffaf8afff (diff)
New upstream version 6.0.20upstream
Diffstat (limited to 'src/mongo/db/ops/insert.cpp')
-rw-r--r--src/mongo/db/ops/insert.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mongo/db/ops/insert.cpp b/src/mongo/db/ops/insert.cpp
index 61d92fda6bf..8c949b333c7 100644
--- a/src/mongo/db/ops/insert.cpp
+++ b/src/mongo/db/ops/insert.cpp
@@ -87,6 +87,7 @@ Status validateDepth(const BSONObj& obj) {
StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
const BSONObj& doc,
+ bool bypassEmptyTsReplacement,
bool* containsDotsAndDollarsField) {
bool validationDisabled = DocumentValidationSettings::get(opCtx).isInternalValidationDisabled();
@@ -139,7 +140,8 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
}
if (!validationDisabled) {
- if (e.type() == bsonTimestamp && e.timestampValue() == 0) {
+ if (!bypassEmptyTsReplacement && e.type() == bsonTimestamp &&
+ e.timestampValue() == 0) {
// we replace Timestamp(0,0) at the top level with a correct value
// in the fast pass, we just mark that we want to swap
hasTimestampToFix = true;
@@ -187,7 +189,8 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
BSONElement e = i.next();
if (hadId && e.fieldNameStringData() == "_id") {
// no-op
- } else if (e.type() == bsonTimestamp && e.timestampValue() == 0) {
+ } else if (!bypassEmptyTsReplacement && e.type() == bsonTimestamp &&
+ e.timestampValue() == 0) {
auto nextTime = VectorClockMutable::get(opCtx)->tickClusterTime(1);
b.append(e.fieldName(), nextTime.asTimestamp());
} else {