summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuhong Zhang <yuhong.zhang@mongodb.com>2022-08-25 13:57:20 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-08-25 14:44:30 +0000
commiteaa4652ee9eef8c206573e90e6ab16831758078c (patch)
treeca7fcc6c75eb8c322cb9c6c5a11181568567b6f9
parentfefcf3b895f2650ca2df12f3d15f4fa55569c95a (diff)
downloadmongo-eaa4652ee9eef8c206573e90e6ab16831758078c.tar.gz
SERVER-68688 Rename `checkBSONConsistency` option to `checkBSONConformance`
-rw-r--r--jstests/disk/validate_bson_inconsistency.js24
-rw-r--r--jstests/noPassthroughWithMongod/validate_checkBSONConformance.js (renamed from jstests/noPassthroughWithMongod/validate_checkBSONConsistency.js)18
-rw-r--r--src/mongo/db/commands/validate.cpp28
3 files changed, 35 insertions, 35 deletions
diff --git a/jstests/disk/validate_bson_inconsistency.js b/jstests/disk/validate_bson_inconsistency.js
index 9ea0e222033..663354b93c4 100644
--- a/jstests/disk/validate_bson_inconsistency.js
+++ b/jstests/disk/validate_bson_inconsistency.js
@@ -34,13 +34,13 @@ resetDbpath(dbpath);
testColl.insert({a: 1, b: 2, c: {b: 3}, d: {a: [2, 3, 4], b: {a: 2}}});
testColl.insert({a: 1, b: 1});
- // Warnings should be triggered iff checkBSONConsistency is set to true.
+ // Warnings should be triggered iff checkBSONConformance is set to true.
let res = assert.commandWorked(testColl.validate());
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 0);
assert.eq(res.warnings.length, 0);
- res = assert.commandWorked(testColl.validate({checkBSONConsistency: true}));
+ res = assert.commandWorked(testColl.validate({checkBSONConformance: true}));
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, numDocs);
assert.eq(res.warnings.length, 1);
@@ -65,12 +65,12 @@ resetDbpath(dbpath);
"deadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef")
});
- let res = coll.validate({checkBSONConsistency: true});
+ let res = coll.validate({checkBSONConformance: true});
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 2);
assert.eq(res.warnings.length, 1);
- res = coll.validate({checkBSONConsistency: false});
+ res = coll.validate({checkBSONConformance: false});
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 2);
assert.eq(res.warnings.length, 1);
@@ -93,12 +93,12 @@ resetDbpath(dbpath);
db = mongod.getDB(baseName);
coll = db[collName];
- let res = coll.validate({checkBSONConsistency: false});
+ let res = coll.validate({checkBSONConformance: false});
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 5);
assert.eq(res.warnings.length, 1);
- res = coll.validate({checkBSONConsistency: true});
+ res = coll.validate({checkBSONConformance: true});
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 5);
assert.eq(res.warnings.length, 1);
@@ -137,7 +137,7 @@ resetDbpath(dbpath);
// Tests that calling validate, with BSONConsistencyCheck true, on a collection with an
// improperly sized md5 returns a warning.
assert.commandWorked(testColl.insert({"md5ImproperBSONConsistencyCheck": improperMD5}));
- res = assert.commandWorked(testColl.validate({checkBSONConsistency: true}));
+ res = assert.commandWorked(testColl.validate({checkBSONConformance: true}));
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 2);
@@ -182,7 +182,7 @@ resetDbpath(dbpath);
assert.eq(res.nNonCompliantDocuments, 7);
assert.eq(res.warnings.length, 1);
- res = assert.commandWorked(testColl.validate({checkBSONConsistency: true}));
+ res = assert.commandWorked(testColl.validate({checkBSONConformance: true}));
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 7);
assert.eq(res.warnings.length, 1);
@@ -205,13 +205,13 @@ resetDbpath(dbpath);
testColl.insert(
{a: BinData(7, "AQAAAAAAAAAAQJN/AAAAAAAAAAIAAAAAAAAABwAAAAAAAAAOAAAAAAAAAAA=")});
- // Calling validate without 'checkBSONConsistency' should not return any warnings.
+ // Calling validate without 'checkBSONConformance' should not return any warnings.
let res = assert.commandWorked(testColl.validate());
assert(res.valid, tojson(res));
assert.eq(res.warnings.length, 0);
assert.eq(res.nNonCompliantDocuments, 0);
- res = assert.commandWorked(testColl.validate({checkBSONConsistency: true}));
+ res = assert.commandWorked(testColl.validate({checkBSONConformance: true}));
assert(res.valid, tojson(res));
assert.eq(res.warnings.length, 1);
assert.eq(res.nNonCompliantDocuments, 1);
@@ -241,7 +241,7 @@ resetDbpath(dbpath);
assert.eq(res.nNonCompliantDocuments, 10);
assert.eq(res.warnings.length, 1);
- res = assert.commandWorked(testColl.validate({checkBSONConsistency: true}));
+ res = assert.commandWorked(testColl.validate({checkBSONConformance: true}));
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 10);
assert.eq(res.warnings.length, 1);
@@ -271,7 +271,7 @@ resetDbpath(dbpath);
assert.eq(res.nNonCompliantDocuments, 0);
assert.eq(res.warnings.length, 0);
- res = assert.commandWorked(testColl.validate({checkBSONConsistency: true}));
+ res = assert.commandWorked(testColl.validate({checkBSONConformance: true}));
assert(res.valid, tojson(res));
assert.eq(res.nNonCompliantDocuments, 10);
assert.eq(res.warnings.length, 1);
diff --git a/jstests/noPassthroughWithMongod/validate_checkBSONConsistency.js b/jstests/noPassthroughWithMongod/validate_checkBSONConformance.js
index dab1163cc40..c95c9c0bef8 100644
--- a/jstests/noPassthroughWithMongod/validate_checkBSONConsistency.js
+++ b/jstests/noPassthroughWithMongod/validate_checkBSONConformance.js
@@ -1,5 +1,5 @@
/*
- * Tests the usage of 'checkBSONConsistency' option of the validate command.
+ * Tests the usage of 'checkBSONConformance' option of the validate command.
*
* @tags: [featureFlagExtendValidateCommand]
*/
@@ -7,32 +7,32 @@
(function() {
"use strict";
-const collName = "validate_checkBSONConsistency";
+const collName = "validate_checkBSONConformance";
const coll = db.getCollection(collName);
coll.drop();
assert.commandWorked(coll.insert({a: 1}));
assert.commandFailedWithCode(
- db.runCommand({validate: collName, checkBSONConsistency: true, metadata: true}),
+ db.runCommand({validate: collName, checkBSONConformance: true, metadata: true}),
ErrorCodes.InvalidOptions);
assert.commandFailedWithCode(
- db.runCommand({validate: collName, checkBSONConsistency: true, repair: true}),
+ db.runCommand({validate: collName, checkBSONConformance: true, repair: true}),
ErrorCodes.InvalidOptions);
assert.commandWorked(
- db.runCommand({validate: collName, checkBSONConsistency: true, background: true}));
+ db.runCommand({validate: collName, checkBSONConformance: true, background: true}));
assert.commandFailedWithCode(
- db.runCommand({validate: collName, checkBSONConsistency: false, full: true}),
+ db.runCommand({validate: collName, checkBSONConformance: false, full: true}),
ErrorCodes.InvalidOptions);
-assert.commandWorked(db.runCommand({validate: collName, checkBSONConsistency: true, full: true}));
+assert.commandWorked(db.runCommand({validate: collName, checkBSONConformance: true, full: true}));
assert.commandFailedWithCode(
- db.runCommand({validate: collName, checkBSONConsistency: false, enforceFastCount: true}),
+ db.runCommand({validate: collName, checkBSONConformance: false, enforceFastCount: true}),
ErrorCodes.InvalidOptions);
assert.commandWorked(
- db.runCommand({validate: collName, checkBSONConsistency: true, enforceFastCount: true}));
+ db.runCommand({validate: collName, checkBSONConformance: true, enforceFastCount: true}));
})();
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index 27c7fd14670..832f2f8f6e0 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -73,7 +73,7 @@ stdx::condition_variable _validationNotifier;
* validate: "collectionNameWithoutTheDBPart",
* full: <bool> // If true, a more thorough (and slower) collection validation is performed.
* background: <bool> // If true, performs validation on the checkpoint of the collection.
- * checkBSONConsistency: <bool> // If true, validates BSON documents more thoroughly.
+ * checkBSONConformance: <bool> // If true, validates BSON documents more thoroughly.
* metadata: <bool> // If true, performs a faster validation only on metadata.
* }
*/
@@ -92,7 +92,7 @@ public:
<< "\tAdd {full: true} option to do a more thorough check.\n"
<< "\tAdd {background: true} to validate in the background.\n"
<< "\tAdd {repair: true} to run repair mode.\n"
- << "\tAdd {checkBSONConsistency: true} to validate BSON documents more thoroughly.\n"
+ << "\tAdd {checkBSONConformance: true} to validate BSON documents more thoroughly.\n"
<< "\tAdd {metadata: true} to only check collection metadata.\n"
<< "Cannot specify both {full: true, background: true}.";
}
@@ -147,19 +147,19 @@ public:
<< " and { enforceFastCount: true } is not supported.");
}
- const auto rawCheckBSONConsistency = cmdObj["checkBSONConsistency"];
- const bool checkBSONConsistency = rawCheckBSONConsistency.trueValue();
- if (rawCheckBSONConsistency &&
+ const auto rawcheckBSONConformance = cmdObj["checkBSONConformance"];
+ const bool checkBSONConformance = rawcheckBSONConformance.trueValue();
+ if (rawcheckBSONConformance &&
!feature_flags::gExtendValidateCommand.isEnabled(
serverGlobalParams.featureCompatibility)) {
uasserted(ErrorCodes::InvalidOptions,
- str::stream() << "The 'checkBSONConsistency' option is not supported by the "
+ str::stream() << "The 'checkBSONConformance' option is not supported by the "
"validate command.");
}
- if (rawCheckBSONConsistency && !checkBSONConsistency &&
+ if (rawcheckBSONConformance && !checkBSONConformance &&
(fullValidate || enforceFastCount)) {
uasserted(ErrorCodes::InvalidOptions,
- str::stream() << "Cannot explicitly set 'checkBSONConsistency: false' with "
+ str::stream() << "Cannot explicitly set 'checkBSONConformance: false' with "
"full validation set.");
}
@@ -180,10 +180,10 @@ public:
<< "Running the validate command with both { enforceFastCount: true }"
<< " and { repair: true } is not supported.");
}
- if (checkBSONConsistency && repair) {
+ if (checkBSONConformance && repair) {
uasserted(ErrorCodes::InvalidOptions,
str::stream()
- << "Running the validate command with both { checkBSONConsistency: true }"
+ << "Running the validate command with both { checkBSONConformance: true }"
<< " and { repair: true } is not supported.");
}
repl::ReplicationCoordinator* replCoord = repl::ReplicationCoordinator::get(opCtx);
@@ -196,7 +196,7 @@ public:
const bool metadata = cmdObj["metadata"].trueValue();
if (metadata &&
- (background || fullValidate || enforceFastCount || checkBSONConsistency || repair)) {
+ (background || fullValidate || enforceFastCount || checkBSONConformance || repair)) {
uasserted(ErrorCodes::InvalidOptions,
str::stream() << "Running the validate command with { metadata: true } is not"
<< " supported with any other options");
@@ -209,7 +209,7 @@ public:
"background"_attr = background,
"full"_attr = fullValidate,
"enforceFastCount"_attr = enforceFastCount,
- "checkBSONConsistency"_attr = checkBSONConsistency,
+ "checkBSONConformance"_attr = checkBSONConformance,
"repair"_attr = repair);
}
@@ -242,7 +242,7 @@ public:
return CollectionValidation::ValidateMode::kMetadata;
}
if (background) {
- if (checkBSONConsistency) {
+ if (checkBSONConformance) {
return CollectionValidation::ValidateMode::kBackgroundCheckBSON;
}
return CollectionValidation::ValidateMode::kBackground;
@@ -253,7 +253,7 @@ public:
if (fullValidate) {
return CollectionValidation::ValidateMode::kForegroundFull;
}
- if (checkBSONConsistency) {
+ if (checkBSONConformance) {
return CollectionValidation::ValidateMode::kForegroundCheckBSON;
}
return CollectionValidation::ValidateMode::kForeground;