diff options
Diffstat (limited to 'jstests/noPassthrough/write_local.js')
-rw-r--r-- | jstests/noPassthrough/write_local.js | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/jstests/noPassthrough/write_local.js b/jstests/noPassthrough/write_local.js index 6eff980d4a9..252baf3d871 100644 --- a/jstests/noPassthrough/write_local.js +++ b/jstests/noPassthrough/write_local.js @@ -1,46 +1,45 @@ // SERVER-22011: Deadlock in ticket distribution // @tags: [requires_replication, requires_capped] (function() { - 'use strict'; +'use strict'; - // Limit concurrent WiredTiger transactions to maximize locking issues, harmless for other SEs. - var options = {verbose: 1}; +// Limit concurrent WiredTiger transactions to maximize locking issues, harmless for other SEs. +var options = {verbose: 1}; - // Create a new single node replicaSet - var replTest = - new ReplSetTest({name: "write_local", nodes: 1, oplogSize: 1, nodeOptions: options}); - replTest.startSet(); - replTest.initiate(); - var mongod = replTest.getPrimary(); - mongod.adminCommand({setParameter: 1, wiredTigerConcurrentWriteTransactions: 1}); +// Create a new single node replicaSet +var replTest = new ReplSetTest({name: "write_local", nodes: 1, oplogSize: 1, nodeOptions: options}); +replTest.startSet(); +replTest.initiate(); +var mongod = replTest.getPrimary(); +mongod.adminCommand({setParameter: 1, wiredTigerConcurrentWriteTransactions: 1}); - var local = mongod.getDB('local'); +var local = mongod.getDB('local'); - // Start inserting documents in test.capped and local.capped capped collections. - var shells = ['test', 'local'].map(function(dbname) { - var mydb = local.getSiblingDB(dbname); - mydb.capped.drop(); - mydb.createCollection('capped', {capped: true, size: 20 * 1000}); - return startParallelShell('var mydb=db.getSiblingDB("' + dbname + '"); ' + - '(function() { ' + - ' for(var i=0; i < 10*1000; i++) { ' + - ' mydb.capped.insert({ x: i }); ' + - ' } ' + - '})();', - mongod.port); - }); +// Start inserting documents in test.capped and local.capped capped collections. +var shells = ['test', 'local'].map(function(dbname) { + var mydb = local.getSiblingDB(dbname); + mydb.capped.drop(); + mydb.createCollection('capped', {capped: true, size: 20 * 1000}); + return startParallelShell('var mydb=db.getSiblingDB("' + dbname + '"); ' + + '(function() { ' + + ' for(var i=0; i < 10*1000; i++) { ' + + ' mydb.capped.insert({ x: i }); ' + + ' } ' + + '})();', + mongod.port); +}); - // The following causes inconsistent locking order in the ticket system, depending on - // timeouts to avoid deadlock. - var oldObjects = 0; - for (var i = 0; i < 1000; i++) { - print(local.stats().objects); - sleep(1); - } +// The following causes inconsistent locking order in the ticket system, depending on +// timeouts to avoid deadlock. +var oldObjects = 0; +for (var i = 0; i < 1000; i++) { + print(local.stats().objects); + sleep(1); +} - // Wait for parallel shells to terminate and stop our replset. - shells.forEach((function(f) { - f(); - })); - replTest.stopSet(); +// Wait for parallel shells to terminate and stop our replset. +shells.forEach((function(f) { + f(); +})); +replTest.stopSet(); }()); |