summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenety Goh <benety@mongodb.com>2021-05-27 12:19:37 -0400
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-08-11 12:36:56 +0000
commit6aa8816af3ed8a323426d912bf74775062632104 (patch)
treeb476a7cbe80e2d5b510e3141acc266f8ca3d3025
parentccae69efa20d3ed011718c54a2523ae63def0936 (diff)
downloadmongo-6aa8816af3ed8a323426d912bf74775062632104.tar.gz
SERVER-57268 add multikey query to validate_multikey_restart.js
(cherry picked from commit 31d6b135b5839e8b42d0b2ac3831f91ed9cd102f)
-rw-r--r--jstests/noPassthrough/validate_multikey_restart.js24
1 files changed, 24 insertions, 0 deletions
diff --git a/jstests/noPassthrough/validate_multikey_restart.js b/jstests/noPassthrough/validate_multikey_restart.js
index e06b6c3bb04..68a50adf4cf 100644
--- a/jstests/noPassthrough/validate_multikey_restart.js
+++ b/jstests/noPassthrough/validate_multikey_restart.js
@@ -35,6 +35,15 @@ let docs = testColl.find().sort({_id: 1}).toArray();
assert.eq(1, docs.length, 'too many docs in collection: ' + tojson(docs));
assert.eq(1, docs[0]._id, 'unexpected document content in collection: ' + tojson(docs));
+jsTestLog('Checking multikey query before restart');
+let multikeyQueryDocs = testColl.find({a: {$in: [4, 5, 6]}}).toArray();
+assert.eq(1,
+ multikeyQueryDocs.length,
+ 'too many docs in multikey query result: ' + tojson(multikeyQueryDocs));
+assert.eq(1,
+ multikeyQueryDocs[0]._id,
+ 'unexpected document content in multikey query result: ' + tojson(multikeyQueryDocs));
+
// For the purpose of reproducing the validation error in a_1, it is important to skip validation
// when restarting the primary node. Enabling validation here has an effect on the validate
// command's behavior after restarting.
@@ -47,6 +56,21 @@ docs = testColl.find().sort({_id: 1}).toArray();
assert.eq(1, docs.length, 'too many docs in collection: ' + tojson(docs));
assert.eq(1, docs[0]._id, 'unexpected document content in collection: ' + tojson(docs));
+jsTestLog('Checking multikey query after restart');
+multikeyQueryDocs = testColl.find({a: {$in: [4, 5, 6]}}).toArray();
+assert.eq(3,
+ multikeyQueryDocs.length,
+ 'too many docs in multikey query result: ' + tojson(multikeyQueryDocs));
+assert.eq(1,
+ multikeyQueryDocs[0]._id,
+ 'unexpected document content in multikey query result: ' + tojson(multikeyQueryDocs));
+assert.eq(1,
+ multikeyQueryDocs[1]._id,
+ 'unexpected document content in multikey query result: ' + tojson(multikeyQueryDocs));
+assert.eq(1,
+ multikeyQueryDocs[2]._id,
+ 'unexpected document content in multikey query result: ' + tojson(multikeyQueryDocs));
+
jsTestLog('Validating collection after restart');
const result = assert.commandWorked(testColl.validate({full: true}));