summaryrefslogtreecommitdiff
path: root/jstests/hooks
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/hooks')
-rw-r--r--jstests/hooks/run_dbcheck_background.js34
-rw-r--r--jstests/hooks/validate_collections.js7
2 files changed, 32 insertions, 9 deletions
diff --git a/jstests/hooks/run_dbcheck_background.js b/jstests/hooks/run_dbcheck_background.js
index 9a62ad58dd3..bb4a67d85af 100644
--- a/jstests/hooks/run_dbcheck_background.js
+++ b/jstests/hooks/run_dbcheck_background.js
@@ -97,16 +97,32 @@ const exceptionFilteredBackgroundDbCheck = function(hosts) {
const healthlog = node.getDB('local').system.healthlog;
// Regex matching strings that start without "SnapshotTooOld"
const regexStringWithoutSnapTooOld = /^((?!^SnapshotTooOld).)*$/;
- let errs =
- healthlog.find({"severity": "error", "data.error": regexStringWithoutSnapTooOld});
- if (errs.hasNext()) {
- const err = "dbCheck found inconsistency on " + node.host;
- jsTestLog(err + ". Errors: ");
- for (let count = 0; errs.hasNext() && count < 20; count++) {
- jsTestLog(tojson(errs.next()));
+
+ // healthlog is a capped collection, truncation during scan might cause cursor
+ // invalidation. Truncated data is most likely from previous tests in the fixture, so we
+ // should still be able to catch errors by retrying.
+ assert.soon(() => {
+ try {
+ let errs = healthlog.find(
+ {"severity": "error", "data.error": regexStringWithoutSnapTooOld});
+ if (errs.hasNext()) {
+ const err = "dbCheck found inconsistency on " + node.host;
+ jsTestLog(err + ". Errors: ");
+ for (let count = 0; errs.hasNext() && count < 20; count++) {
+ jsTestLog(tojson(errs.next()));
+ }
+ assert(false, err);
+ }
+ return true;
+ } catch (e) {
+ if (e.code !== ErrorCodes.CappedPositionLost) {
+ throw e;
+ }
+ jsTestLog(`Retrying on CappedPositionLost error: ${tojson(e)}`);
+ return false;
}
- assert(false, err);
- }
+ }, "healthlog scan could not complete.", 60000);
+
jsTestLog("Checked health log on " + node.host);
});
diff --git a/jstests/hooks/validate_collections.js b/jstests/hooks/validate_collections.js
index 1ef1a9a761a..70459c59141 100644
--- a/jstests/hooks/validate_collections.js
+++ b/jstests/hooks/validate_collections.js
@@ -70,6 +70,13 @@ function CollectionValidator() {
print('Skipping collection validation for ' + coll.getFullName() +
' since collection was not found');
continue;
+ } else if (res.codeName === "CommandNotSupportedOnView") {
+ // Even though we pass a filter to getCollectionInfos() to only fetch
+ // collections, nothing is preventing the collection from being dropped and
+ // recreated as a view.
+ print('Skipping collection validation for ' + coll.getFullName() +
+ ' as it is a view');
+ continue;
}
const host = db.getMongo().host;
print('Collection validation failed on host ' + host +