summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/validate_memory_limit.js
diff options
context:
space:
mode:
authorDan Larkin-York <dan.larkin-york@mongodb.com>2023-03-07 17:20:55 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-03-17 00:12:19 +0000
commit08bcd3ec37715a36a6b2320aea65546f006e243a (patch)
tree172609fa8151c3f343c7e9d1adc9f1c6ca634c8c /jstests/noPassthrough/validate_memory_limit.js
parent4bf05dc66d1a7b64e2100508a0814849772e7999 (diff)
downloadmongo-08bcd3ec37715a36a6b2320aea65546f006e243a.tar.gz
SERVER-74631 Log index spec when validation detects index key inconsistencies
(cherry picked from commit 354b3b2ff1a72bef452b0037a707ecdc6879bff1)
Diffstat (limited to 'jstests/noPassthrough/validate_memory_limit.js')
-rw-r--r--jstests/noPassthrough/validate_memory_limit.js7
1 files changed, 7 insertions, 0 deletions
diff --git a/jstests/noPassthrough/validate_memory_limit.js b/jstests/noPassthrough/validate_memory_limit.js
index f229d2848c8..40dbdd36626 100644
--- a/jstests/noPassthrough/validate_memory_limit.js
+++ b/jstests/noPassthrough/validate_memory_limit.js
@@ -34,12 +34,18 @@ function checkValidate(maxMemoryUsage, {minMissingKeys, maxMissingKeys}) {
assert.lte(res.missingIndexEntries.length, maxMissingKeys, tojson(res));
}
+function checkValidateLogs() {
+ assert(checkLog.checkContainsOnceJson(
+ conn, 7463100, {"spec": {"v": 2, "key": {"_id": 1}, "name": "_id_"}}));
+}
+
// Insert a document with a key larger than maxValidateMemoryUsageMB and test that we still report
// at least one inconsistency.
const indexKey = "a".repeat(kIndexKeyLength);
assert.commandWorked(coll.insert({_id: indexKey}));
corruptIndex();
checkValidate(1, {minMissingKeys: 1, maxMissingKeys: 1});
+checkValidateLogs();
// Clear collection between tests.
coll.drop();
@@ -56,6 +62,7 @@ corruptIndex();
// each key is counted twice, so realistically we only expect to track 2 of them. However, there's
// a small chance we could get hash collisions that would lead to us reporting only 1.
checkValidate(1, {minMissingKeys: 1, maxMissingKeys: 2});
+checkValidateLogs();
MongoRunner.stopMongod(conn, null, {skipValidation: true});
})(); \ No newline at end of file