summaryrefslogtreecommitdiff
path: root/jstests
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-16 21:46:12 +0000
commit91958f623b194a19fa50d18958b24d73726ba488 (patch)
tree7acf6f8a06409a694b90352150b33fc6d68f3211 /jstests
parent2c684d00b9f9695efda211d745ec5c461dc49e95 (diff)
downloadmongo-91958f623b194a19fa50d18958b24d73726ba488.tar.gz
SERVER-74631 Log index spec when validation detects index key inconsistencies
(cherry picked from commit 354b3b2ff1a72bef452b0037a707ecdc6879bff1)
Diffstat (limited to 'jstests')
-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 5a576743177..63f55a0ed43 100644
--- a/jstests/noPassthrough/validate_memory_limit.js
+++ b/jstests/noPassthrough/validate_memory_limit.js
@@ -37,6 +37,11 @@ function checkValidate(maxMemoryUsage, {minMissingKeys, maxMissingKeys}) {
assert.lte(res.missingIndexEntries.length, maxMissingKeys, tojson(res));
}
+function checkValidateLogs() {
+ assert(checkLog.checkContainsWithAtLeastCountJson(
+ conn, 7463100, {"spec": {"v": 2, "key": {"_id": 1}, "name": "_id_"}}, 1));
+}
+
function checkValidateRepair() {
const res = coll.validate({repair: true});
assert.commandWorked(res);
@@ -50,6 +55,7 @@ const indexKey = "a".repeat(kIndexKeyLength);
assert.commandWorked(coll.insert({_id: indexKey}));
corruptIndex();
checkValidate(1, {minMissingKeys: 1, maxMissingKeys: 1});
+checkValidateLogs();
// Can't repair successfully if there aren't any index inconsistencies reported.
checkValidateRepair();
@@ -69,6 +75,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();
// Repair, but incompletely if only some inconsistencies are reported.
checkValidateRepair();