diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-03-25 01:22:47 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2018-03-25 01:22:47 -0400 |
commit | 2c5a4238a190f52dd2a301524c751aa3fac3a8d8 (patch) | |
tree | b060521c924ea8d5f97b48cf7b6744c92f0153d2 | |
parent | b7e00e85cff5d18593ea21f6b87b116d370c98ca (diff) | |
download | mongo-2c5a4238a190f52dd2a301524c751aa3fac3a8d8.tar.gz |
SERVER-31128 Skip validate on NotMaster error response.
This change is in preparation for running the validate command against
secondaries in a replica set.
The fuzzer test suites require that the validate command is only run
when the server's featureCompatibilityVersion=3.4. Otherwise, it is
possible that previously inserted Decimal128 data could lead to an
actually innocuous data consistency failure.
-rw-r--r-- | jstests/hooks/validate_collections.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js index e64bb39d305..c5be1a230e8 100644 --- a/jstests/hooks/validate_collections.js +++ b/jstests/hooks/validate_collections.js @@ -56,8 +56,18 @@ function validateCollections(db, obj) { } } - setFeatureCompatibilityVersion( - adminDB, jsTest.options().forceValidationWithFeatureCompatibilityVersion); + try { + setFeatureCompatibilityVersion( + adminDB, jsTest.options().forceValidationWithFeatureCompatibilityVersion); + } catch (e) { + if (e.code === ErrorCodes.NotMaster) { + print('Skipping collection validation on ' + db.getMongo() + ' because the' + + ' featureCompatibilityVersion cannot be changed while connected to a' + + ' secondary'); + return true; + } + throw e; + } } // Don't run validate on view namespaces. |