summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Guo <robert.guo@10gen.com>2016-02-09 13:49:48 -0500
committerRobert Guo <robert.guo@10gen.com>2016-02-09 13:49:48 -0500
commit4c9a823b6ec3de808c675c99f0fec40f48c491ca (patch)
tree3984f7e0d2bfc62ece49df34960fd880d4af9adb
parentaff0ad5caf150d1ee547806b45db074eb0ec18d3 (diff)
downloadmongo-4c9a823b6ec3de808c675c99f0fec40f48c491ca.tar.gz
Revert "SERVER-22234 add tests"
This reverts commit aff0ad5caf150d1ee547806b45db074eb0ec18d3.
-rw-r--r--buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml1
-rw-r--r--buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml1
-rw-r--r--jstests/core/index_bigkeys_validation.js28
-rw-r--r--jstests/libs/parallelTester.js5
-rw-r--r--src/mongo/db/catalog/collection.cpp27
-rw-r--r--src/mongo/db/commands/validate.cpp7
6 files changed, 17 insertions, 52 deletions
diff --git a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml
index c8aa4df0857..6b51a5f17f5 100644
--- a/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/sharded_collections_jscore_passthrough.yml
@@ -25,7 +25,6 @@ selector:
- jstests/core/geo_s2cursorlimitskip.js # profiling.
- jstests/core/geo_update_btree2.js # notablescan.
- jstests/core/index_bigkeys_nofail.js # failIndexKeyTooLong.
- - jstests/core/index_bigkeys_validation.js # failIndexKeyTooLong.
- jstests/core/max_time_ms.js # sleep, SERVER-2212.
- jstests/core/mr_replaceIntoDB.js # MapReduceResult, SERVER-20495.
- jstests/core/notablescan.js # notablescan.
diff --git a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml
index f217b513534..56a5b581ce8 100644
--- a/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml
+++ b/buildscripts/resmokeconfig/suites/sharding_jscore_passthrough.yml
@@ -24,7 +24,6 @@ selector:
- jstests/core/geo_s2cursorlimitskip.js # profiling.
- jstests/core/geo_update_btree2.js # notablescan.
- jstests/core/index_bigkeys_nofail.js # failIndexKeyTooLong.
- - jstests/core/index_bigkeys_validation.js # failIndexKeyTooLong.
- jstests/core/max_time_ms.js # sleep, SERVER-2212.
- jstests/core/notablescan.js # notablescan.
- jstests/core/profile*.js # profiling.
diff --git a/jstests/core/index_bigkeys_validation.js b/jstests/core/index_bigkeys_validation.js
deleted file mode 100644
index 88e2816fc8d..00000000000
--- a/jstests/core/index_bigkeys_validation.js
+++ /dev/null
@@ -1,28 +0,0 @@
-// Tests that index validation succeeds for long keys when failIndexKeyTooLong is set to false.
-// See: SERVER-22234
-'use strict';
-
-(function() {
- var coll = db.longindex;
- coll.drop();
-
- var longVal = new Array(1025).join('x'); // Keys >= 1024 bytes cannot be indexed.
-
- assert.commandWorked(db.adminCommand({setParameter: 1, failIndexKeyTooLong: false}));
-
- assert.writeOK(coll.insert({_id: longVal}));
- // Verify that validation succeeds when the failIndexKeyTooLong parameter is set to false,
- // even when there are fewer index keys than documents.
- var res = coll.validate({full: true, scandata: true});
- assert.commandWorked(res);
- assert(res.valid, tojson(res));
-
- // Change failIndexKeyTooLong back to the default value.
- assert.commandWorked(db.adminCommand({setParameter: 1, failIndexKeyTooLong: true}));
-
- // Verify that validation fails when the failIndexKeyTooLong parameter is
- // reverted to its old value and there are mismatched index keys and documents.
- res = coll.validate({full: true, scandata: true});
- assert.commandWorked(res);
- assert.eq(res.valid, false, tojson(res));
-})();
diff --git a/jstests/libs/parallelTester.js b/jstests/libs/parallelTester.js
index 39035731449..743d15b9825 100644
--- a/jstests/libs/parallelTester.js
+++ b/jstests/libs/parallelTester.js
@@ -115,10 +115,9 @@ if (typeof _threadInject != "undefined") {
"extent.js",
"indexb.js",
- // Tests that set a parameter that causes the server to ignore
- // long index keys.
+ // sets a failpoint that causes the server to ignore long keys,
+ // which makes index_bigkeys.js fail
"index_bigkeys_nofail.js",
- "index_bigkeys_validation.js",
// tests turn on profiling
"profile1.js",
diff --git a/src/mongo/db/catalog/collection.cpp b/src/mongo/db/catalog/collection.cpp
index c3ea2c0ed80..bc14618b4b9 100644
--- a/src/mongo/db/catalog/collection.cpp
+++ b/src/mongo/db/catalog/collection.cpp
@@ -926,16 +926,24 @@ void validateIndexKeyCount(OperationContext* txn,
int64_t numIdxKeys,
int64_t numRecs,
ValidateResults* results) {
+ if (!failIndexKeyTooLong) {
+ string warning =
+ "the server is configured with {failIndexKeyTooLong: false}. Validation failures "
+ "resulting from having fewer index entries than documents are downgraded from errors "
+ "to warnings";
+ results->warnings.push_back(warning);
+ }
+
if (idx.isIdIndex() && numIdxKeys != numRecs) {
string msg = str::stream() << "number of _id index entries (" << numIdxKeys
<< ") does not match the number of documents (" << numRecs
<< ")";
- if (!failIndexKeyTooLong && (numIdxKeys < numRecs)) {
- results->warnings.push_back(msg);
- } else {
+ if (failIndexKeyTooLong) {
results->errors.push_back(msg);
results->valid = false;
+ } else {
+ results->warnings.push_back(msg);
}
return; // Avoid failing the next two checks, they just add redundant/confusing messages
@@ -955,11 +963,11 @@ void validateIndexKeyCount(OperationContext* txn,
<< " is not sparse or partial, but has fewer entries ("
<< numIdxKeys << ") than documents (" << numRecs << ")";
- if (!failIndexKeyTooLong) {
- results->warnings.push_back(msg);
- } else {
+ if (failIndexKeyTooLong) {
results->errors.push_back(msg);
results->valid = false;
+ } else {
+ results->warnings.push_back(msg);
}
}
}
@@ -978,13 +986,6 @@ Status Collection::validate(OperationContext* txn,
return status;
{ // indexes
- if (!failIndexKeyTooLong) {
- string warning =
- "The server is configured with the failIndexKeyTooLong parameter set to false. "
- "Validation failures that result from having fewer index entries than documents "
- "have been downgraded from errors to warnings";
- results->warnings.push_back(warning);
- }
output->append("nIndexes", _indexCatalog.numIndexesReady(txn));
int idxn = 0;
try {
diff --git a/src/mongo/db/commands/validate.cpp b/src/mongo/db/commands/validate.cpp
index 93693e68c57..b4f87e353b7 100644
--- a/src/mongo/db/commands/validate.cpp
+++ b/src/mongo/db/commands/validate.cpp
@@ -117,12 +117,7 @@ public:
result.append("errors", results.errors);
if (!results.valid) {
- result.append("advice",
- "A corrupt namespace has been detected. See "
- "http://dochub.mongodb.org/core/data-recovery for recovery steps. Note "
- "that validation failures may also result from running a server with the "
- "failIndexKeyTooLong parameter set to false and later disabling the "
- "parameter.");
+ result.append("advice", "ns corrupt. See http://dochub.mongodb.org/core/data-recovery");
}
return true;