diff options
Diffstat (limited to 'jstests/noPassthrough/wt_prepare_conflict.js')
-rw-r--r-- | jstests/noPassthrough/wt_prepare_conflict.js | 102 |
1 files changed, 45 insertions, 57 deletions
diff --git a/jstests/noPassthrough/wt_prepare_conflict.js b/jstests/noPassthrough/wt_prepare_conflict.js index 67fffd10210..c562c0eab2f 100644 --- a/jstests/noPassthrough/wt_prepare_conflict.js +++ b/jstests/noPassthrough/wt_prepare_conflict.js @@ -4,61 +4,49 @@ * @tag: [requires_wiredtiger] */ (function() { - "strict"; - - let conn = MongoRunner.runMongod(); - let testDB = conn.getDB("test"); - - let t = testDB.prepare_conflict; - t.drop(); - - // Test different types of operations: removals, updates, and index operations. - assert.commandWorked(t.createIndex({x: 1})); - assert.commandWorked( - t.createIndex({y: 1}, {partialFilterExpression: {_id: {$gte: 500}}, unique: true})); - let rand = {"#RAND_INT": [0, 1000]}; - let ops = [ - {op: "remove", ns: t.getFullName(), query: {_id: rand}}, - {op: "findOne", ns: t.getFullName(), query: {_id: rand}}, - { - op: "update", - ns: t.getFullName(), - query: {_id: rand}, - update: {$inc: {x: 1}}, - upsert: true - }, - {op: "findOne", ns: t.getFullName(), query: {x: rand}}, - { - op: "update", - ns: t.getFullName(), - query: {_id: rand}, - update: {$inc: {y: 1}}, - upsert: true - }, - {op: "findOne", ns: t.getFullName(), query: {y: rand}}, - {op: "findOne", ns: t.getFullName(), query: {_id: rand}}, - ]; - - let seconds = 5; - let parallel = 5; - let host = testDB.getMongo().host; - - let benchArgs = {ops, seconds, parallel, host}; - - assert.commandWorked(testDB.adminCommand( - {configureFailPoint: 'WTAlwaysNotifyPrepareConflictWaiters', mode: 'alwaysOn'})); - - assert.commandWorked(testDB.adminCommand( - {configureFailPoint: 'WTPrepareConflictForReads', mode: {activationProbability: 0.05}})); - - res = benchRun(benchArgs); - - assert.commandWorked( - testDB.adminCommand({configureFailPoint: 'WTPrepareConflictForReads', mode: "off"})); - - assert.commandWorked(testDB.adminCommand( - {configureFailPoint: 'WTAlwaysNotifyPrepareConflictWaiters', mode: 'off'})); - res = t.validate(); - assert(res.valid, tojson(res)); - MongoRunner.stopMongod(conn); +"strict"; + +let conn = MongoRunner.runMongod(); +let testDB = conn.getDB("test"); + +let t = testDB.prepare_conflict; +t.drop(); + +// Test different types of operations: removals, updates, and index operations. +assert.commandWorked(t.createIndex({x: 1})); +assert.commandWorked( + t.createIndex({y: 1}, {partialFilterExpression: {_id: {$gte: 500}}, unique: true})); +let rand = {"#RAND_INT": [0, 1000]}; +let ops = [ + {op: "remove", ns: t.getFullName(), query: {_id: rand}}, + {op: "findOne", ns: t.getFullName(), query: {_id: rand}}, + {op: "update", ns: t.getFullName(), query: {_id: rand}, update: {$inc: {x: 1}}, upsert: true}, + {op: "findOne", ns: t.getFullName(), query: {x: rand}}, + {op: "update", ns: t.getFullName(), query: {_id: rand}, update: {$inc: {y: 1}}, upsert: true}, + {op: "findOne", ns: t.getFullName(), query: {y: rand}}, + {op: "findOne", ns: t.getFullName(), query: {_id: rand}}, +]; + +let seconds = 5; +let parallel = 5; +let host = testDB.getMongo().host; + +let benchArgs = {ops, seconds, parallel, host}; + +assert.commandWorked(testDB.adminCommand( + {configureFailPoint: 'WTAlwaysNotifyPrepareConflictWaiters', mode: 'alwaysOn'})); + +assert.commandWorked(testDB.adminCommand( + {configureFailPoint: 'WTPrepareConflictForReads', mode: {activationProbability: 0.05}})); + +res = benchRun(benchArgs); + +assert.commandWorked( + testDB.adminCommand({configureFailPoint: 'WTPrepareConflictForReads', mode: "off"})); + +assert.commandWorked( + testDB.adminCommand({configureFailPoint: 'WTAlwaysNotifyPrepareConflictWaiters', mode: 'off'})); +res = t.validate(); +assert(res.valid, tojson(res)); +MongoRunner.stopMongod(conn); })(); |