summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops/insert.cpp
diff options
context:
space:
mode:
authorLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
committerLucas de Castro Borges <lucas@gnuabordo.com.br>2025-02-11 15:07:35 -0300
commit4cb8841196d0625dfa3825aa326f071cd27c7b8b (patch)
tree1682a647d4463397c119183369ae6f750d5fdcff /src/mongo/db/ops/insert.cpp
parentaa03c6362cbaa767638e6eed9b031d86dd2643d1 (diff)
parent8f0827553e09872941945a093b647a4211a9db7f (diff)
Update upstream source from tag 'upstream/6.0.0'master
Update to upstream version '6.0.0' with Debian dir 5604a80ec1c96ca76f25f40d78e6ef855abec322
Diffstat (limited to 'src/mongo/db/ops/insert.cpp')
-rw-r--r--src/mongo/db/ops/insert.cpp18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/mongo/db/ops/insert.cpp b/src/mongo/db/ops/insert.cpp
index 8c949b333c7..8db1935b4b8 100644
--- a/src/mongo/db/ops/insert.cpp
+++ b/src/mongo/db/ops/insert.cpp
@@ -35,7 +35,6 @@
#include "mongo/bson/bson_depth.h"
#include "mongo/db/catalog/document_validation.h"
#include "mongo/db/commands/feature_compatibility_version_parser.h"
-#include "mongo/db/mongod_options_storage_gen.h"
#include "mongo/db/query/dbref.h"
#include "mongo/db/query/query_feature_flags_gen.h"
#include "mongo/db/repl/replication_coordinator.h"
@@ -87,20 +86,11 @@ Status validateDepth(const BSONObj& obj) {
StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
const BSONObj& doc,
- bool bypassEmptyTsReplacement,
bool* containsDotsAndDollarsField) {
bool validationDisabled = DocumentValidationSettings::get(opCtx).isInternalValidationDisabled();
if (!validationDisabled) {
- // 'gAllowDocumentsGreaterThanMaxUserSize' should only ever be enabled when restoring a node
- // from a backup. For some restores, we re-insert whole oplog entries from a
- // source cluster to a destination cluster. Some generated oplog entries may exceed the user
- // maximum due to entry metadata, and therefore we should skip BSON size validation for
- // these inserts. Note that we should only skip the size check when inserting oplog entries
- // into the oplog and not when inserting user documents. The oplog entries to insert have
- // already been validated for size on the source cluster, and were successfully inserted
- // into the source oplog.
- if (doc.objsize() > BSONObjMaxUserSize && !gAllowDocumentsGreaterThanMaxUserSize)
+ if (doc.objsize() > BSONObjMaxUserSize)
return StatusWith<BSONObj>(ErrorCodes::BadValue,
str::stream() << "object to insert too large"
<< ". size in bytes: " << doc.objsize()
@@ -140,8 +130,7 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
}
if (!validationDisabled) {
- if (!bypassEmptyTsReplacement && e.type() == bsonTimestamp &&
- e.timestampValue() == 0) {
+ if (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;
@@ -189,8 +178,7 @@ StatusWith<BSONObj> fixDocumentForInsert(OperationContext* opCtx,
BSONElement e = i.next();
if (hadId && e.fieldNameStringData() == "_id") {
// no-op
- } else if (!bypassEmptyTsReplacement && e.type() == bsonTimestamp &&
- e.timestampValue() == 0) {
+ } else if (e.type() == bsonTimestamp && e.timestampValue() == 0) {
auto nextTime = VectorClockMutable::get(opCtx)->tickClusterTime(1);
b.append(e.fieldName(), nextTime.asTimestamp());
} else {