summaryrefslogtreecommitdiff
path: root/jstests/noPassthrough/query_yields_catch_index_corruption.js
diff options
context:
space:
mode:
Diffstat (limited to 'jstests/noPassthrough/query_yields_catch_index_corruption.js')
-rw-r--r--jstests/noPassthrough/query_yields_catch_index_corruption.js33
1 files changed, 0 insertions, 33 deletions
diff --git a/jstests/noPassthrough/query_yields_catch_index_corruption.js b/jstests/noPassthrough/query_yields_catch_index_corruption.js
index 0e172940550..d05119e8b1e 100644
--- a/jstests/noPassthrough/query_yields_catch_index_corruption.js
+++ b/jstests/noPassthrough/query_yields_catch_index_corruption.js
@@ -29,40 +29,12 @@ assert.commandWorked(coll.createIndex({a: 1, b: 1}));
// entry (thanks to the "skipUnindexingDocumentWhenDeleted" failpoint).
function createDanglingIndexEntry(doc) {
assert.commandWorked(coll.insert(doc));
- const docId = coll.findOne(doc)._id;
assert.commandWorked(coll.remove(doc));
// Validation should now fail.
const validateRes = assert.commandWorked(coll.validate());
assert.eq(false, validateRes.valid);
- // Server logs for failed validation command should contain oplog entries related to corrupted
- // index entry.
- let foundInsert = false;
- let foundDelete = false;
- // Look for log message "Oplog entry found for corrupted collection and index entry" (msg id
- // 7462402).
- checkLog.containsJson(db.getMongo(), 7464202, {
- oplogEntryDoc: (oplogDoc) => {
- let oplogDocId;
- try {
- oplogDocId = ObjectId(oplogDoc.o._id.$oid);
- } catch (ex) {
- return false;
- }
- if (!oplogDocId.equals(docId)) {
- return false;
- }
- jsTestLog('Found oplog entry for corrupted index entry: ' + tojson(oplogDoc));
- if (oplogDoc.op === 'd') {
- foundDelete = true;
- } else if (oplogDoc.op === 'i') {
- foundInsert = true;
- }
- return foundDelete && foundInsert;
- }
- });
-
// A query that accesses the now dangling index entry should fail with a
// "DataCorruptionDetected" error. Most reads will not detect this problem because they ignore
// prepare conflicts by default and that exempts them from checking this assertion. Only writes
@@ -79,11 +51,6 @@ function createDanglingIndexEntry(doc) {
sessionDB[collName].find(doc).toArray();
}, ErrorCodes.DataCorruptionDetected);
session.abortTransaction_forTesting();
-
- // Ensure the health log entry is written out after data corruption is detected.
- assert.soon(() => {
- return primary.getDB("local").getCollection("system.healthlog").count() > 0;
- }, "Health log entry was not written out");
}
createDanglingIndexEntry({a: 1, b: 1});