diff options
Diffstat (limited to 'jstests/noPassthrough/write_conflict_wildcard.js')
-rw-r--r-- | jstests/noPassthrough/write_conflict_wildcard.js | 50 |
1 files changed, 24 insertions, 26 deletions
diff --git a/jstests/noPassthrough/write_conflict_wildcard.js b/jstests/noPassthrough/write_conflict_wildcard.js index f5662cdf119..ae2fcca5fc4 100644 --- a/jstests/noPassthrough/write_conflict_wildcard.js +++ b/jstests/noPassthrough/write_conflict_wildcard.js @@ -3,37 +3,35 @@ * interacting with the storage layer to retrieve multikey paths. */ (function() { - "strict"; +"strict"; - const conn = MongoRunner.runMongod(); - const testDB = conn.getDB("test"); +const conn = MongoRunner.runMongod(); +const testDB = conn.getDB("test"); - const coll = testDB.write_conflict_wildcard; - coll.drop(); +const coll = testDB.write_conflict_wildcard; +coll.drop(); - assert.commandWorked(coll.createIndex({"$**": 1})); +assert.commandWorked(coll.createIndex({"$**": 1})); - assert.commandWorked(testDB.adminCommand({ - configureFailPoint: 'WTWriteConflictExceptionForReads', - mode: {activationProbability: 0.01} +assert.commandWorked(testDB.adminCommand( + {configureFailPoint: 'WTWriteConflictExceptionForReads', mode: {activationProbability: 0.01}})); +for (let i = 0; i < 1000; ++i) { + // Insert documents with a couple different multikey paths to increase the number of records + // scanned during multikey path computation in the wildcard index. + assert.commandWorked(coll.insert({ + _id: i, + i: i, + a: [{x: i - 1}, {x: i}, {x: i + 1}], + b: [], + longerName: [{nested: [1, 2]}, {nested: 4}] })); - for (let i = 0; i < 1000; ++i) { - // Insert documents with a couple different multikey paths to increase the number of records - // scanned during multikey path computation in the wildcard index. - assert.commandWorked(coll.insert({ - _id: i, - i: i, - a: [{x: i - 1}, {x: i}, {x: i + 1}], - b: [], - longerName: [{nested: [1, 2]}, {nested: 4}] - })); - assert.eq(coll.find({i: i}).hint({"$**": 1}).itcount(), 1); - if (i > 0) { - assert.eq(coll.find({"a.x": i}).hint({"$**": 1}).itcount(), 2); - } + assert.eq(coll.find({i: i}).hint({"$**": 1}).itcount(), 1); + if (i > 0) { + assert.eq(coll.find({"a.x": i}).hint({"$**": 1}).itcount(), 2); } +} - assert.commandWorked( - testDB.adminCommand({configureFailPoint: 'WTWriteConflictExceptionForReads', mode: "off"})); - MongoRunner.stopMongod(conn); +assert.commandWorked( + testDB.adminCommand({configureFailPoint: 'WTWriteConflictExceptionForReads', mode: "off"})); +MongoRunner.stopMongod(conn); })(); |