diff options
Diffstat (limited to 'jstests/concurrency')
157 files changed, 404 insertions, 685 deletions
diff --git a/jstests/concurrency/fsm_example.js b/jstests/concurrency/fsm_example.js index 45b8ac5b47a..fb012462a15 100644 --- a/jstests/concurrency/fsm_example.js +++ b/jstests/concurrency/fsm_example.js @@ -7,7 +7,6 @@ * Serves as a template for new workloads. */ var $config = (function() { - // 'data' is passed (copied) to each of the worker threads. var data = {}; @@ -81,5 +80,4 @@ var $config = (function() { teardown: teardown, // optional, default empty function data: data // optional, default empty object }; - })(); diff --git a/jstests/concurrency/fsm_libs/assert.js b/jstests/concurrency/fsm_libs/assert.js index 437742ac396..f4b47acc0fe 100644 --- a/jstests/concurrency/fsm_libs/assert.js +++ b/jstests/concurrency/fsm_libs/assert.js @@ -12,7 +12,6 @@ */ var AssertLevel = (function() { - function AssertLevel(level) { this.level = level; @@ -34,7 +33,6 @@ var AssertLevel = (function() { OWN_DB: new AssertLevel(2), isAssertLevel: isAssertLevel }; - })(); if (typeof globalAssertLevel === 'undefined') { diff --git a/jstests/concurrency/fsm_libs/cluster.js b/jstests/concurrency/fsm_libs/cluster.js index b848fa355ed..1b24c9bbdbb 100644 --- a/jstests/concurrency/fsm_libs/cluster.js +++ b/jstests/concurrency/fsm_libs/cluster.js @@ -53,8 +53,8 @@ var Cluster = function(options) { getObjectKeys(options).forEach(function(option) { assert.contains(option, allowedKeys, - 'invalid option: ' + tojson(option) + '; valid options are: ' + - tojson(allowedKeys)); + 'invalid option: ' + tojson(option) + + '; valid options are: ' + tojson(allowedKeys)); }); options.replication = options.replication || {}; @@ -271,7 +271,7 @@ var Cluster = function(options) { this.executeOnMongodNodes = function executeOnMongodNodes(fn) { assert(initialized, 'cluster must be initialized first'); - if (!fn || typeof(fn) !== 'function' || fn.length !== 1) { + if (!fn || typeof (fn) !== 'function' || fn.length !== 1) { throw new Error('mongod function must be a function that takes a db as an argument'); } _conns.mongod.forEach(function(mongodConn) { @@ -282,7 +282,7 @@ var Cluster = function(options) { this.executeOnMongosNodes = function executeOnMongosNodes(fn) { assert(initialized, 'cluster must be initialized first'); - if (!fn || typeof(fn) !== 'function' || fn.length !== 1) { + if (!fn || typeof (fn) !== 'function' || fn.length !== 1) { throw new Error('mongos function must be a function that takes a db as an argument'); } _conns.mongos.forEach(function(mongosConn) { @@ -293,7 +293,7 @@ var Cluster = function(options) { this.executeOnConfigNodes = function executeOnConfigNodes(fn) { assert(initialized, 'cluster must be initialized first'); - if (!fn || typeof(fn) !== 'function' || fn.length !== 1) { + if (!fn || typeof (fn) !== 'function' || fn.length !== 1) { throw new Error('config function must be a function that takes a db as an argument'); } st._configServers.forEach(function(conn) { @@ -553,8 +553,8 @@ var Cluster = function(options) { var primaryInfo = replSetStatus.members.find(memberInfo => memberInfo.self); assert(primaryInfo !== undefined, - phase + ', failed to find self in replication status: ' + - tojson(replSetStatus)); + phase + + ', failed to find self in replication status: ' + tojson(replSetStatus)); // Wait for all previous workload operations to complete, with "getLastError". res = primary.getDB('test').runCommand({ @@ -565,7 +565,6 @@ var Cluster = function(options) { }); assert.commandWorked(res, phase + ', error awaiting replication'); } - }); }; diff --git a/jstests/concurrency/fsm_libs/composer.js b/jstests/concurrency/fsm_libs/composer.js index 99cfb64f34d..22d78e77871 100644 --- a/jstests/concurrency/fsm_libs/composer.js +++ b/jstests/concurrency/fsm_libs/composer.js @@ -1,7 +1,6 @@ load('jstests/concurrency/fsm_libs/fsm.js'); var composer = (function() { - function runCombinedFSM(workloads, configs, mixProb) { // TODO: what if a workload depends on iterations? var iterations = 100; @@ -70,5 +69,4 @@ var composer = (function() { } return {run: runCombinedFSM}; - })(); diff --git a/jstests/concurrency/fsm_libs/extend_workload.js b/jstests/concurrency/fsm_libs/extend_workload.js index c00f8c80e99..eb9e681eb4e 100644 --- a/jstests/concurrency/fsm_libs/extend_workload.js +++ b/jstests/concurrency/fsm_libs/extend_workload.js @@ -2,7 +2,8 @@ load('jstests/concurrency/fsm_libs/parse_config.js'); // for parseConfig -/** extendWorkload usage: +/** + * extendWorkload usage: * * $config = extendWorkload($config, function($config, $super) { * // ... modify $config ... @@ -25,7 +26,8 @@ function extendWorkload($config, callback) { return callback(childConfig, parsedSuperConfig); } -/** assignEqualProbsToTransitions example usage: +/** + * assignEqualProbsToTransitions example usage: * $config.transitions = Object.extend({<state>: * assignEqualProbsToTransitions(Object.keys($config.states))}, $super.transitions); */ diff --git a/jstests/concurrency/fsm_libs/parse_config.js b/jstests/concurrency/fsm_libs/parse_config.js index 3c365dc5f4c..3d673e6c062 100644 --- a/jstests/concurrency/fsm_libs/parse_config.js +++ b/jstests/concurrency/fsm_libs/parse_config.js @@ -61,8 +61,8 @@ function parseConfig(config) { assert.gt(Object.keys(config.transitions[fromState]).length, 0); Object.keys(config.transitions[fromState]).forEach(function(toState) { assert(config.states.hasOwnProperty(toState), - 'config.transitions.' + fromState + ' contains a state not in config.states: ' + - toState); + 'config.transitions.' + fromState + + ' contains a state not in config.states: ' + toState); assert.eq('number', typeof config.transitions[fromState][toState], 'transitions.' + fromState + '.' + toState + ' should be a number'); diff --git a/jstests/concurrency/fsm_libs/resmoke_runner.js b/jstests/concurrency/fsm_libs/resmoke_runner.js index 908eb126cb0..75569dde140 100644 --- a/jstests/concurrency/fsm_libs/resmoke_runner.js +++ b/jstests/concurrency/fsm_libs/resmoke_runner.js @@ -1,285 +1,284 @@ (function() { - 'use strict'; +'use strict'; + +load('jstests/concurrency/fsm_libs/runner.js'); // for runner.internals +load('jstests/libs/discover_topology.js'); // For Topology and DiscoverTopology. + +const validateExecutionOptions = runner.internals.validateExecutionOptions; +const prepareCollections = runner.internals.prepareCollections; +const WorkloadFailure = runner.internals.WorkloadFailure; +const throwError = runner.internals.throwError; +const setupWorkload = runner.internals.setupWorkload; +const teardownWorkload = runner.internals.teardownWorkload; +const setIterations = runner.internals.setIterations; +const setThreadCount = runner.internals.setThreadCount; +const loadWorkloadContext = runner.internals.loadWorkloadContext; + +// Returns true if the workload's teardown succeeds and false if the workload's teardown fails. +function cleanupWorkload(workload, context, cluster, errors, header) { + const phase = 'before workload ' + workload + ' teardown'; + + try { + teardownWorkload(workload, context, cluster); + } catch (e) { + errors.push(new WorkloadFailure(e.toString(), e.stack, 'main', header + ' Teardown')); + return false; + } - load('jstests/concurrency/fsm_libs/runner.js'); // for runner.internals - load('jstests/libs/discover_topology.js'); // For Topology and DiscoverTopology. + return true; +} - const validateExecutionOptions = runner.internals.validateExecutionOptions; - const prepareCollections = runner.internals.prepareCollections; - const WorkloadFailure = runner.internals.WorkloadFailure; - const throwError = runner.internals.throwError; - const setupWorkload = runner.internals.setupWorkload; - const teardownWorkload = runner.internals.teardownWorkload; - const setIterations = runner.internals.setIterations; - const setThreadCount = runner.internals.setThreadCount; - const loadWorkloadContext = runner.internals.loadWorkloadContext; +function runWorkloads(workloads, + {cluster: clusterOptions = {}, execution: executionOptions = {}} = {}) { + assert.gt(workloads.length, 0, 'need at least one workload to run'); - // Returns true if the workload's teardown succeeds and false if the workload's teardown fails. - function cleanupWorkload(workload, context, cluster, errors, header) { - const phase = 'before workload ' + workload + ' teardown'; + const executionMode = {serial: true}; + validateExecutionOptions(executionMode, executionOptions); + Object.freeze(executionOptions); // immutable after validation (and normalization) - try { - teardownWorkload(workload, context, cluster); - } catch (e) { - errors.push(new WorkloadFailure(e.toString(), e.stack, 'main', header + ' Teardown')); - return false; - } - - return true; + // Determine how strong to make assertions while simultaneously executing different + // workloads. + let assertLevel = AssertLevel.OWN_DB; + if (clusterOptions.sameDB) { + // The database is shared by multiple workloads, so only make the asserts that apply + // when the collection is owned by an individual workload. + assertLevel = AssertLevel.OWN_COLL; } + if (clusterOptions.sameCollection) { + // The collection is shared by multiple workloads, so only make the asserts that always + // apply. + assertLevel = AssertLevel.ALWAYS; + } + globalAssertLevel = assertLevel; - function runWorkloads(workloads, - {cluster: clusterOptions = {}, execution: executionOptions = {}} = {}) { - assert.gt(workloads.length, 0, 'need at least one workload to run'); - - const executionMode = {serial: true}; - validateExecutionOptions(executionMode, executionOptions); - Object.freeze(executionOptions); // immutable after validation (and normalization) - - // Determine how strong to make assertions while simultaneously executing different - // workloads. - let assertLevel = AssertLevel.OWN_DB; - if (clusterOptions.sameDB) { - // The database is shared by multiple workloads, so only make the asserts that apply - // when the collection is owned by an individual workload. - assertLevel = AssertLevel.OWN_COLL; - } - if (clusterOptions.sameCollection) { - // The collection is shared by multiple workloads, so only make the asserts that always - // apply. - assertLevel = AssertLevel.ALWAYS; - } - globalAssertLevel = assertLevel; - - const context = {}; - const applyMultipliers = true; - loadWorkloadContext(workloads, context, executionOptions, applyMultipliers); + const context = {}; + const applyMultipliers = true; + loadWorkloadContext(workloads, context, executionOptions, applyMultipliers); - // Constructing a Cluster instance calls its internal validateClusterOptions() function, - // which fills in any properties that aren't explicitly present in 'clusterOptions'. We do - // this before constructing a ThreadManager instance to make its dependency on the - // 'clusterOptions' being filled in explicit. - const cluster = new Cluster(clusterOptions); - const threadMgr = new ThreadManager(clusterOptions, executionMode); + // Constructing a Cluster instance calls its internal validateClusterOptions() function, + // which fills in any properties that aren't explicitly present in 'clusterOptions'. We do + // this before constructing a ThreadManager instance to make its dependency on the + // 'clusterOptions' being filled in explicit. + const cluster = new Cluster(clusterOptions); + const threadMgr = new ThreadManager(clusterOptions, executionMode); - Random.setRandomSeed(clusterOptions.seed); + Random.setRandomSeed(clusterOptions.seed); - const errors = []; - const cleanup = []; - let teardownFailed = false; - let startTime = Date.now(); // Initialize in case setupWorkload fails below. - let totalTime; + const errors = []; + const cleanup = []; + let teardownFailed = false; + let startTime = Date.now(); // Initialize in case setupWorkload fails below. + let totalTime; - cluster.setup(); + cluster.setup(); - jsTest.log('Workload(s) started: ' + workloads.join(' ')); + jsTest.log('Workload(s) started: ' + workloads.join(' ')); - prepareCollections(workloads, context, cluster, clusterOptions, executionOptions); + prepareCollections(workloads, context, cluster, clusterOptions, executionOptions); - try { - // Set up the thread manager for this set of workloads. - startTime = Date.now(); + try { + // Set up the thread manager for this set of workloads. + startTime = Date.now(); - { - const maxAllowedThreads = 100 * executionOptions.threadMultiplier; - threadMgr.init(workloads, context, maxAllowedThreads); - } + { + const maxAllowedThreads = 100 * executionOptions.threadMultiplier; + threadMgr.init(workloads, context, maxAllowedThreads); + } - // Call each workload's setup function. - workloads.forEach(function(workload) { - // Define "iterations" and "threadCount" properties on the workload's $config.data - // object so that they can be used within its setup(), teardown(), and state - // functions. This must happen after calling threadMgr.init() in case the thread - // counts needed to be scaled down. - setIterations(context[workload].config); - setThreadCount(context[workload].config); - - setupWorkload(workload, context, cluster); - cleanup.push(workload); - }); - - // Await replication after running the $config.setup() function when stepdowns are - // permitted to ensure its effects aren't rolled back. - if (cluster.isReplication() && executionOptions.stepdownFiles !== undefined) { - cluster.awaitReplication(); - } + // Call each workload's setup function. + workloads.forEach(function(workload) { + // Define "iterations" and "threadCount" properties on the workload's $config.data + // object so that they can be used within its setup(), teardown(), and state + // functions. This must happen after calling threadMgr.init() in case the thread + // counts needed to be scaled down. + setIterations(context[workload].config); + setThreadCount(context[workload].config); + + setupWorkload(workload, context, cluster); + cleanup.push(workload); + }); + + // Await replication after running the $config.setup() function when stepdowns are + // permitted to ensure its effects aren't rolled back. + if (cluster.isReplication() && executionOptions.stepdownFiles !== undefined) { + cluster.awaitReplication(); + } - // Transactions run at snapshot read concern unless defaultTransactionReadConcernLevel - // is set to another level. - const transactionsWouldUseSnapshotReadConcern = - !TestData.hasOwnProperty("defaultTransactionReadConcernLevel") || - TestData.defaultTransactionReadConcernLevel === "snapshot"; - - // Synchronize the cluster times across all routers if the tests will be overriden to - // use transactions, so the earliest global snapshots chosen by each router will include - // the effects of each setup function. This is only required for snapshot read concern. - if (cluster.isSharded() && TestData.runInsideTransaction && - transactionsWouldUseSnapshotReadConcern) { - cluster.synchronizeMongosClusterTimes(); - } + // Transactions run at snapshot read concern unless defaultTransactionReadConcernLevel + // is set to another level. + const transactionsWouldUseSnapshotReadConcern = + !TestData.hasOwnProperty("defaultTransactionReadConcernLevel") || + TestData.defaultTransactionReadConcernLevel === "snapshot"; + + // Synchronize the cluster times across all routers if the tests will be overriden to + // use transactions, so the earliest global snapshots chosen by each router will include + // the effects of each setup function. This is only required for snapshot read concern. + if (cluster.isSharded() && TestData.runInsideTransaction && + transactionsWouldUseSnapshotReadConcern) { + cluster.synchronizeMongosClusterTimes(); + } - // After the $config.setup() function has been called, it is safe for the stepdown - // thread to start running. The main thread won't attempt to interact with the cluster - // until all of the spawned worker threads have finished. - // + // After the $config.setup() function has been called, it is safe for the stepdown + // thread to start running. The main thread won't attempt to interact with the cluster + // until all of the spawned worker threads have finished. + // - // Indicate that the stepdown thread can run. It is unnecessary for the stepdown thread - // to indicate that it is going to start running because it will eventually after the - // worker threads have started. - if (executionOptions.stepdownFiles !== undefined) { - writeFile(executionOptions.stepdownFiles.permitted, ''); - } + // Indicate that the stepdown thread can run. It is unnecessary for the stepdown thread + // to indicate that it is going to start running because it will eventually after the + // worker threads have started. + if (executionOptions.stepdownFiles !== undefined) { + writeFile(executionOptions.stepdownFiles.permitted, ''); + } - // Since the worker threads may be running with causal consistency enabled, we set the - // initial clusterTime and initial operationTime for the sessions they'll create so that - // they are guaranteed to observe the effects of the workload's $config.setup() function - // being called. - if (typeof executionOptions.sessionOptions === 'object' && - executionOptions.sessionOptions !== null) { - // We only start a session for the worker threads and never start one for the main - // thread. We can therefore get the clusterTime and operationTime tracked by the - // underlying DummyDriverSession through any DB instance (i.e. the "test" database - // here was chosen arbitrarily). - const session = cluster.getDB('test').getSession(); - - // JavaScript objects backed by C++ objects (e.g. BSON values from a command - // response) do not serialize correctly when passed through the ScopedThread - // constructor. To work around this behavior, we instead pass a stringified form of - // the JavaScript object through the ScopedThread constructor and use eval() to - // rehydrate it. - executionOptions.sessionOptions.initialClusterTime = - tojson(session.getClusterTime()); - executionOptions.sessionOptions.initialOperationTime = - tojson(session.getOperationTime()); - } + // Since the worker threads may be running with causal consistency enabled, we set the + // initial clusterTime and initial operationTime for the sessions they'll create so that + // they are guaranteed to observe the effects of the workload's $config.setup() function + // being called. + if (typeof executionOptions.sessionOptions === 'object' && + executionOptions.sessionOptions !== null) { + // We only start a session for the worker threads and never start one for the main + // thread. We can therefore get the clusterTime and operationTime tracked by the + // underlying DummyDriverSession through any DB instance (i.e. the "test" database + // here was chosen arbitrarily). + const session = cluster.getDB('test').getSession(); + + // JavaScript objects backed by C++ objects (e.g. BSON values from a command + // response) do not serialize correctly when passed through the ScopedThread + // constructor. To work around this behavior, we instead pass a stringified form of + // the JavaScript object through the ScopedThread constructor and use eval() to + // rehydrate it. + executionOptions.sessionOptions.initialClusterTime = tojson(session.getClusterTime()); + executionOptions.sessionOptions.initialOperationTime = + tojson(session.getOperationTime()); + } + try { try { - try { - // Start this set of worker threads. - threadMgr.spawnAll(cluster, executionOptions); - // Allow 20% of the threads to fail. This allows the workloads to run on - // underpowered test hosts. - threadMgr.checkFailed(0.2); - } finally { - // Threads must be joined before destruction, so do this even in the presence of - // exceptions. - errors.push(...threadMgr.joinAll().map( - e => new WorkloadFailure( - e.err, e.stack, e.tid, 'Foreground ' + e.workloads.join(' ')))); - } + // Start this set of worker threads. + threadMgr.spawnAll(cluster, executionOptions); + // Allow 20% of the threads to fail. This allows the workloads to run on + // underpowered test hosts. + threadMgr.checkFailed(0.2); } finally { - // Until we are guaranteed that the stepdown thread isn't running, it isn't safe for - // the $config.teardown() function to be called. We should signal to resmoke.py that - // the stepdown thread should stop running and wait for the stepdown thread to - // signal that it has stopped. - // - // Signal to the stepdown thread to stop stepping down the cluster. - if (executionOptions.stepdownFiles !== undefined) { - writeFile(executionOptions.stepdownFiles.idleRequest, ''); - - // Wait for the acknowledgement file to be created by the stepdown thread. - assert.soonNoExcept(function() { - // The cat() function will throw an exception if the file isn't found. - cat(executionOptions.stepdownFiles.idleAck); - return true; - }, "stepdown still in progress"); - } + // Threads must be joined before destruction, so do this even in the presence of + // exceptions. + errors.push(...threadMgr.joinAll().map( + e => new WorkloadFailure( + e.err, e.stack, e.tid, 'Foreground ' + e.workloads.join(' ')))); } } finally { - if (cluster.shouldPerformContinuousStepdowns()) { - cluster.reestablishConnectionsAfterFailover(); + // Until we are guaranteed that the stepdown thread isn't running, it isn't safe for + // the $config.teardown() function to be called. We should signal to resmoke.py that + // the stepdown thread should stop running and wait for the stepdown thread to + // signal that it has stopped. + // + // Signal to the stepdown thread to stop stepping down the cluster. + if (executionOptions.stepdownFiles !== undefined) { + writeFile(executionOptions.stepdownFiles.idleRequest, ''); + + // Wait for the acknowledgement file to be created by the stepdown thread. + assert.soonNoExcept(function() { + // The cat() function will throw an exception if the file isn't found. + cat(executionOptions.stepdownFiles.idleAck); + return true; + }, "stepdown still in progress"); } - // Call each workload's teardown function. After all teardowns have completed check if - // any of them failed. - const cleanupResults = cleanup.map( - workload => cleanupWorkload(workload, context, cluster, errors, 'Foreground')); - teardownFailed = cleanupResults.some(success => (success === false)); - - totalTime = Date.now() - startTime; - jsTest.log('Workload(s) completed in ' + totalTime + ' ms: ' + workloads.join(' ')); } - - // Throw any existing errors so that resmoke.py can abort its execution of the test suite. - throwError(errors); - - cluster.teardown(); - } - - if (typeof db === 'undefined') { - throw new Error( - 'resmoke_runner.js must be run with the mongo shell already connected to the database'); - } - - const clusterOptions = { - replication: {enabled: false}, - sharded: {enabled: false}, - }; - - // The TestData.discoverTopoloy is false when we only care about connecting to either a - // standalone or primary node in a replica set. - if (TestData.discoverTopology !== false) { - const topology = DiscoverTopology.findConnectedNodes(db.getMongo()); - - if (topology.type === Topology.kReplicaSet) { - clusterOptions.replication.enabled = true; - clusterOptions.replication.numNodes = topology.nodes.length; - } else if (topology.type === Topology.kShardedCluster) { - clusterOptions.replication.enabled = TestData.usingReplicaSetShards || false; - clusterOptions.sharded.enabled = true; - clusterOptions.sharded.enableAutoSplit = TestData.hasOwnProperty('runningWithAutoSplit') - ? TestData.runningWithAutoSplit - : true; - clusterOptions.sharded.enableBalancer = TestData.hasOwnProperty('runningWithBalancer') - ? TestData.runningWithBalancer - : true; - clusterOptions.sharded.numMongos = topology.mongos.nodes.length; - clusterOptions.sharded.numShards = Object.keys(topology.shards).length; - clusterOptions.sharded.stepdownOptions = {}; - clusterOptions.sharded.stepdownOptions.configStepdown = - TestData.runningWithConfigStepdowns || false; - clusterOptions.sharded.stepdownOptions.shardStepdown = - TestData.runningWithShardStepdowns || false; - } else if (topology.type !== Topology.kStandalone) { - throw new Error('Unrecognized topology format: ' + tojson(topology)); + } finally { + if (cluster.shouldPerformContinuousStepdowns()) { + cluster.reestablishConnectionsAfterFailover(); } + // Call each workload's teardown function. After all teardowns have completed check if + // any of them failed. + const cleanupResults = cleanup.map( + workload => cleanupWorkload(workload, context, cluster, errors, 'Foreground')); + teardownFailed = cleanupResults.some(success => (success === false)); + + totalTime = Date.now() - startTime; + jsTest.log('Workload(s) completed in ' + totalTime + ' ms: ' + workloads.join(' ')); } - clusterOptions.sameDB = TestData.sameDB; - clusterOptions.sameCollection = TestData.sameCollection; + // Throw any existing errors so that resmoke.py can abort its execution of the test suite. + throwError(errors); + + cluster.teardown(); +} + +if (typeof db === 'undefined') { + throw new Error( + 'resmoke_runner.js must be run with the mongo shell already connected to the database'); +} + +const clusterOptions = { + replication: {enabled: false}, + sharded: {enabled: false}, +}; + +// The TestData.discoverTopoloy is false when we only care about connecting to either a +// standalone or primary node in a replica set. +if (TestData.discoverTopology !== false) { + const topology = DiscoverTopology.findConnectedNodes(db.getMongo()); + + if (topology.type === Topology.kReplicaSet) { + clusterOptions.replication.enabled = true; + clusterOptions.replication.numNodes = topology.nodes.length; + } else if (topology.type === Topology.kShardedCluster) { + clusterOptions.replication.enabled = TestData.usingReplicaSetShards || false; + clusterOptions.sharded.enabled = true; + clusterOptions.sharded.enableAutoSplit = + TestData.hasOwnProperty('runningWithAutoSplit') ? TestData.runningWithAutoSplit : true; + clusterOptions.sharded.enableBalancer = + TestData.hasOwnProperty('runningWithBalancer') ? TestData.runningWithBalancer : true; + clusterOptions.sharded.numMongos = topology.mongos.nodes.length; + clusterOptions.sharded.numShards = Object.keys(topology.shards).length; + clusterOptions.sharded.stepdownOptions = {}; + clusterOptions.sharded.stepdownOptions.configStepdown = + TestData.runningWithConfigStepdowns || false; + clusterOptions.sharded.stepdownOptions.shardStepdown = + TestData.runningWithShardStepdowns || false; + } else if (topology.type !== Topology.kStandalone) { + throw new Error('Unrecognized topology format: ' + tojson(topology)); + } +} - let workloads = TestData.fsmWorkloads; +clusterOptions.sameDB = TestData.sameDB; +clusterOptions.sameCollection = TestData.sameCollection; - let sessionOptions = {}; - if (TestData.runningWithCausalConsistency !== undefined) { - // Explicit sessions are causally consistent by default, so causal consistency has to be - // explicitly disabled. - sessionOptions.causalConsistency = TestData.runningWithCausalConsistency; +let workloads = TestData.fsmWorkloads; - if (TestData.runningWithCausalConsistency) { - sessionOptions.readPreference = {mode: 'secondary'}; - } - } +let sessionOptions = {}; +if (TestData.runningWithCausalConsistency !== undefined) { + // Explicit sessions are causally consistent by default, so causal consistency has to be + // explicitly disabled. + sessionOptions.causalConsistency = TestData.runningWithCausalConsistency; - if (TestData.runningWithConfigStepdowns || TestData.runningWithShardStepdowns) { - sessionOptions.retryWrites = true; - } - - const executionOptions = {dbNamePrefix: TestData.dbNamePrefix || ""}; - const resmokeDbPathPrefix = TestData.resmokeDbPathPrefix || "."; - - // The stepdown file names need to match the same construction as found in - // buildscripts/resmokelib/testing/hooks/stepdown.py. - if (TestData.useStepdownPermittedFile) { - executionOptions.stepdownFiles = { - permitted: resmokeDbPathPrefix + '/permitted', - idleRequest: resmokeDbPathPrefix + '/idle_request', - idleAck: resmokeDbPathPrefix + '/idle_ack', - }; + if (TestData.runningWithCausalConsistency) { + sessionOptions.readPreference = {mode: 'secondary'}; } +} + +if (TestData.runningWithConfigStepdowns || TestData.runningWithShardStepdowns) { + sessionOptions.retryWrites = true; +} + +const executionOptions = { + dbNamePrefix: TestData.dbNamePrefix || "" +}; +const resmokeDbPathPrefix = TestData.resmokeDbPathPrefix || "."; + +// The stepdown file names need to match the same construction as found in +// buildscripts/resmokelib/testing/hooks/stepdown.py. +if (TestData.useStepdownPermittedFile) { + executionOptions.stepdownFiles = { + permitted: resmokeDbPathPrefix + '/permitted', + idleRequest: resmokeDbPathPrefix + '/idle_request', + idleAck: resmokeDbPathPrefix + '/idle_ack', + }; +} - if (Object.keys(sessionOptions).length > 0 || TestData.runningWithSessions) { - executionOptions.sessionOptions = sessionOptions; - } +if (Object.keys(sessionOptions).length > 0 || TestData.runningWithSessions) { + executionOptions.sessionOptions = sessionOptions; +} - runWorkloads(workloads, {cluster: clusterOptions, execution: executionOptions}); +runWorkloads(workloads, {cluster: clusterOptions, execution: executionOptions}); })(); diff --git a/jstests/concurrency/fsm_libs/runner.js b/jstests/concurrency/fsm_libs/runner.js index e02d0fb4086..7350786910d 100644 --- a/jstests/concurrency/fsm_libs/runner.js +++ b/jstests/concurrency/fsm_libs/runner.js @@ -8,15 +8,14 @@ load('jstests/concurrency/fsm_utils/name_utils.js'); // for uniqueCollName and load('jstests/concurrency/fsm_utils/setup_teardown_functions.js'); var runner = (function() { - function validateExecutionMode(mode) { var allowedKeys = ['composed', 'parallel', 'serial']; Object.keys(mode).forEach(function(option) { assert.contains(option, allowedKeys, - 'invalid option: ' + tojson(option) + '; valid options are: ' + - tojson(allowedKeys)); + 'invalid option: ' + tojson(option) + + '; valid options are: ' + tojson(allowedKeys)); }); mode.composed = mode.composed || false; @@ -61,8 +60,8 @@ var runner = (function() { Object.keys(options).forEach(function(option) { assert.contains(option, allowedKeys, - 'invalid option: ' + tojson(option) + '; valid options are: ' + - tojson(allowedKeys)); + 'invalid option: ' + tojson(option) + + '; valid options are: ' + tojson(allowedKeys)); }); if (typeof options.subsetSize !== 'undefined') { @@ -130,8 +129,8 @@ var runner = (function() { Object.keys(options).forEach(function(option) { assert.contains(option, allowedKeys, - 'invalid option: ' + tojson(option) + '; valid options are: ' + - tojson(allowedKeys)); + 'invalid option: ' + tojson(option) + + '; valid options are: ' + tojson(allowedKeys)); }); if (typeof options.dropDatabaseBlacklist !== 'undefined') { @@ -752,7 +751,6 @@ var runner = (function() { loadWorkloadContext, } }; - })(); var runWorkloadsSerially = runner.serial; diff --git a/jstests/concurrency/fsm_libs/worker_thread.js b/jstests/concurrency/fsm_libs/worker_thread.js index f5a827794c6..cb172148fe0 100644 --- a/jstests/concurrency/fsm_libs/worker_thread.js +++ b/jstests/concurrency/fsm_libs/worker_thread.js @@ -6,7 +6,6 @@ load('jstests/concurrency/fsm_libs/parse_config.js'); // for parseConfig load('jstests/libs/specific_secondary_reader_mongo.js'); var workerThread = (function() { - // workloads = list of workload filenames // args.tid = the thread identifier // args.data = map of workload -> 'this' parameter passed to the FSM state functions @@ -193,8 +192,7 @@ var workerThread = (function() { // them here as non-configurable and non-writable. Object.defineProperties(data, { 'iterations': {configurable: false, writable: false, value: data.iterations}, - 'threadCount': - {configurable: false, writable: false, value: data.threadCount} + 'threadCount': {configurable: false, writable: false, value: data.threadCount} }); data.tid = args.tid; diff --git a/jstests/concurrency/fsm_selftests.js b/jstests/concurrency/fsm_selftests.js index 30c614e9148..95b9b5a0d96 100644 --- a/jstests/concurrency/fsm_selftests.js +++ b/jstests/concurrency/fsm_selftests.js @@ -7,37 +7,37 @@ load('jstests/concurrency/fsm_libs/fsm.js'); (function() { - var getWeightedRandomChoice = fsm._getWeightedRandomChoice; +var getWeightedRandomChoice = fsm._getWeightedRandomChoice; - var doc = {a: 0.25, b: 0.5, c: 0.25}; +var doc = {a: 0.25, b: 0.5, c: 0.25}; - // NOTE: getWeightedRandomChoice calls assert internally, so it will print stack traces - // when assert.throws executes - assert.throws(function() { - getWeightedRandomChoice(doc, -1); - }, [], 'should reject negative values'); - assert.throws(function() { - getWeightedRandomChoice(doc, 1); - }, [], 'should reject values == 1'); - assert.throws(function() { - getWeightedRandomChoice(doc, 2); - }, [], 'should reject values > 1'); +// NOTE: getWeightedRandomChoice calls assert internally, so it will print stack traces +// when assert.throws executes +assert.throws(function() { + getWeightedRandomChoice(doc, -1); +}, [], 'should reject negative values'); +assert.throws(function() { + getWeightedRandomChoice(doc, 1); +}, [], 'should reject values == 1'); +assert.throws(function() { + getWeightedRandomChoice(doc, 2); +}, [], 'should reject values > 1'); - assert.throws(function() { - getWeightedRandomChoice({}, 0.0); - }, [], 'cannot choose from zero states'); - assert.throws(function() { - getWeightedRandomChoice({}, 0.5); - }, [], 'cannot choose from zero states'); - assert.throws(function() { - getWeightedRandomChoice({}, 0.99); - }, [], 'cannot choose from zero states'); +assert.throws(function() { + getWeightedRandomChoice({}, 0.0); +}, [], 'cannot choose from zero states'); +assert.throws(function() { + getWeightedRandomChoice({}, 0.5); +}, [], 'cannot choose from zero states'); +assert.throws(function() { + getWeightedRandomChoice({}, 0.99); +}, [], 'cannot choose from zero states'); - assert.eq('a', getWeightedRandomChoice(doc, 0.00), '0'); - assert.eq('a', getWeightedRandomChoice(doc, 0.24), '1'); - assert.eq('b', getWeightedRandomChoice(doc, 0.25), '2'); - assert.eq('b', getWeightedRandomChoice(doc, 0.50), '3'); - assert.eq('b', getWeightedRandomChoice(doc, 0.74), '4'); - assert.eq('c', getWeightedRandomChoice(doc, 0.75), '5'); - assert.eq('c', getWeightedRandomChoice(doc, 0.99), '6'); +assert.eq('a', getWeightedRandomChoice(doc, 0.00), '0'); +assert.eq('a', getWeightedRandomChoice(doc, 0.24), '1'); +assert.eq('b', getWeightedRandomChoice(doc, 0.25), '2'); +assert.eq('b', getWeightedRandomChoice(doc, 0.50), '3'); +assert.eq('b', getWeightedRandomChoice(doc, 0.74), '4'); +assert.eq('c', getWeightedRandomChoice(doc, 0.75), '5'); +assert.eq('c', getWeightedRandomChoice(doc, 0.99), '6'); })(); diff --git a/jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js b/jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js index 43bdc7ea8a8..9f8ed997895 100644 --- a/jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js +++ b/jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js @@ -1,7 +1,6 @@ 'use strict'; var {withTxnAndAutoRetry, isKilledSessionCode} = (function() { - /** * Calls 'func' with the print() function overridden to be a no-op. * @@ -71,9 +70,9 @@ var {withTxnAndAutoRetry, isKilledSessionCode} = (function() { // is a retryable write. if (!commitRes.ok && retryOnKilledSession && isKilledSessionCode(commitRes.code)) { print("-=-=-=- Retrying commit after killed session code, sessionId: " + - tojsononeline(session.getSessionId()) + ", txnNumber: " + - tojsononeline(session.getTxnNumber_forTesting()) + ", res: " + - tojsononeline(commitRes)); + tojsononeline(session.getSessionId()) + + ", txnNumber: " + tojsononeline(session.getTxnNumber_forTesting()) + + ", res: " + tojsononeline(commitRes)); continue; } diff --git a/jstests/concurrency/fsm_workloads/access_collection_in_transaction_after_catalog_changes.js b/jstests/concurrency/fsm_workloads/access_collection_in_transaction_after_catalog_changes.js index 1ad738f437b..7a825f6c009 100644 --- a/jstests/concurrency/fsm_workloads/access_collection_in_transaction_after_catalog_changes.js +++ b/jstests/concurrency/fsm_workloads/access_collection_in_transaction_after_catalog_changes.js @@ -15,9 +15,7 @@ */ var $config = (function() { - var states = (function() { - function init(db, collName) { this.session = db.getMongo().startSession(); } @@ -41,10 +39,10 @@ var $config = (function() { } catch (e) { assertWhenOwnColl.contains(e.code, [ - ErrorCodes.LockTimeout, - ErrorCodes.WriteConflict, - ErrorCodes.SnapshotUnavailable, - ErrorCodes.OperationNotSupportedInTransaction + ErrorCodes.LockTimeout, + ErrorCodes.WriteConflict, + ErrorCodes.SnapshotUnavailable, + ErrorCodes.OperationNotSupportedInTransaction ], () => tojson(e)); } @@ -338,5 +336,4 @@ var $config = (function() { setup: setup, teardown: teardown }; - })(); diff --git a/jstests/concurrency/fsm_workloads/agg_base.js b/jstests/concurrency/fsm_workloads/agg_base.js index ec598ef00c8..b38c8771d74 100644 --- a/jstests/concurrency/fsm_workloads/agg_base.js +++ b/jstests/concurrency/fsm_workloads/agg_base.js @@ -7,7 +7,6 @@ * then each thread does an aggregation with an empty $match. */ var $config = (function() { - var data = { numDocs: 1000, // Use 12KB documents by default. This number is useful because 12,000 documents each of diff --git a/jstests/concurrency/fsm_workloads/agg_graph_lookup.js b/jstests/concurrency/fsm_workloads/agg_graph_lookup.js index b10fc88a99d..5dbdd784ae0 100644 --- a/jstests/concurrency/fsm_workloads/agg_graph_lookup.js +++ b/jstests/concurrency/fsm_workloads/agg_graph_lookup.js @@ -6,7 +6,6 @@ * Runs a $graphLookup aggregation simultaneously with updates. */ var $config = (function() { - var data = {numDocs: 1000}; var states = { diff --git a/jstests/concurrency/fsm_workloads/agg_group_external.js b/jstests/concurrency/fsm_workloads/agg_group_external.js index ae60b810424..adb7a787e20 100644 --- a/jstests/concurrency/fsm_workloads/agg_group_external.js +++ b/jstests/concurrency/fsm_workloads/agg_group_external.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/agg_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // use enough docs to exceed 100MB, the in-memory limit for $sort and $group $config.data.numDocs = 24 * 1000; var MB = 1024 * 1024; // bytes diff --git a/jstests/concurrency/fsm_workloads/agg_match.js b/jstests/concurrency/fsm_workloads/agg_match.js index 91b4eef3755..58971c4d30a 100644 --- a/jstests/concurrency/fsm_workloads/agg_match.js +++ b/jstests/concurrency/fsm_workloads/agg_match.js @@ -9,7 +9,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/agg_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.getOutCollName = function getOutCollName(collName) { return collName + '_out_agg_match'; }; diff --git a/jstests/concurrency/fsm_workloads/agg_merge_when_matched_replace_with_new.js b/jstests/concurrency/fsm_workloads/agg_merge_when_matched_replace_with_new.js index 5b26801afbf..169de096aa2 100644 --- a/jstests/concurrency/fsm_workloads/agg_merge_when_matched_replace_with_new.js +++ b/jstests/concurrency/fsm_workloads/agg_merge_when_matched_replace_with_new.js @@ -23,11 +23,11 @@ var $config = extendWorkload($config, function($config, $super) { const res = db[collName].aggregate([ {$addFields: {_id: this.tid, count: this.threadRunCount}}, { - $merge: { - into: this.collWithMigrations, - whenMatched: "replace", - whenNotMatched: "insert" - } + $merge: { + into: this.collWithMigrations, + whenMatched: "replace", + whenNotMatched: "insert" + } }, ]); diff --git a/jstests/concurrency/fsm_workloads/agg_merge_when_not_matched_insert.js b/jstests/concurrency/fsm_workloads/agg_merge_when_not_matched_insert.js index ef8f5ab6c04..084b8c9b0d0 100644 --- a/jstests/concurrency/fsm_workloads/agg_merge_when_not_matched_insert.js +++ b/jstests/concurrency/fsm_workloads/agg_merge_when_not_matched_insert.js @@ -20,15 +20,15 @@ var $config = extendWorkload($config, function($config, $super) { $config.states.aggregate = function aggregate(db, collName, connCache) { const res = db[collName].aggregate([ { - $project: { - "_id.tid": {$literal: this.tid}, - "_id.count": {$literal: this.threadRunCount}, - "_id.doc": "$_id" - } + $project: { + "_id.tid": {$literal: this.tid}, + "_id.count": {$literal: this.threadRunCount}, + "_id.doc": "$_id" + } }, { - $merge: - {into: this.collWithMigrations, whenMatched: "fail", whenNotMatched: "insert"} + $merge: + {into: this.collWithMigrations, whenMatched: "fail", whenNotMatched: "insert"} }, ]); diff --git a/jstests/concurrency/fsm_workloads/agg_out.js b/jstests/concurrency/fsm_workloads/agg_out.js index 33ced7f4ff6..d5c0a7ec7cb 100644 --- a/jstests/concurrency/fsm_workloads/agg_out.js +++ b/jstests/concurrency/fsm_workloads/agg_out.js @@ -19,7 +19,6 @@ load('jstests/concurrency/fsm_workloads/agg_base.js'); // for $confi load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongos var $config = extendWorkload($config, function($config, $super) { - // Use a smaller document size, but more iterations. The smaller documents will ensure each // operation is faster, giving us time to do more operations and thus increasing the likelihood // that any two operations will be happening concurrently. diff --git a/jstests/concurrency/fsm_workloads/agg_out_interrupt_cleanup.js b/jstests/concurrency/fsm_workloads/agg_out_interrupt_cleanup.js index d36769776fd..60c31b8a429 100644 --- a/jstests/concurrency/fsm_workloads/agg_out_interrupt_cleanup.js +++ b/jstests/concurrency/fsm_workloads/agg_out_interrupt_cleanup.js @@ -9,7 +9,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/agg_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states.aggregate = function aggregate(db, collName) { // $out to the same collection so that concurrent aggregate commands would cause congestion. db[collName].runCommand( diff --git a/jstests/concurrency/fsm_workloads/agg_sort.js b/jstests/concurrency/fsm_workloads/agg_sort.js index 8a04195fe15..757ecf76097 100644 --- a/jstests/concurrency/fsm_workloads/agg_sort.js +++ b/jstests/concurrency/fsm_workloads/agg_sort.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/agg_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.getOutputCollPrefix = function getOutputCollPrefix(collName) { return collName + '_out_agg_sort_'; }; diff --git a/jstests/concurrency/fsm_workloads/agg_sort_external.js b/jstests/concurrency/fsm_workloads/agg_sort_external.js index f843d623ff3..b8cbad826bb 100644 --- a/jstests/concurrency/fsm_workloads/agg_sort_external.js +++ b/jstests/concurrency/fsm_workloads/agg_sort_external.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/agg_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // use enough docs to exceed 100MB, the in-memory limit for $sort and $group $config.data.numDocs = 24 * 1000; var MB = 1024 * 1024; // bytes diff --git a/jstests/concurrency/fsm_workloads/agg_with_chunk_migrations.js b/jstests/concurrency/fsm_workloads/agg_with_chunk_migrations.js index 093ff9b4870..721b653eec1 100644 --- a/jstests/concurrency/fsm_workloads/agg_with_chunk_migrations.js +++ b/jstests/concurrency/fsm_workloads/agg_with_chunk_migrations.js @@ -17,7 +17,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // load('jstests/concurrency/fsm_workloads/sharded_moveChunk_partitioned.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // The base setup will insert 'partitionSize' number of documents per thread, evenly // distributing across the chunks. Documents will only have the "_id" field. $config.data.partitionSize = 50; diff --git a/jstests/concurrency/fsm_workloads/auth_create_role.js b/jstests/concurrency/fsm_workloads/auth_create_role.js index 6ad5de17d9a..1cc041b876a 100644 --- a/jstests/concurrency/fsm_workloads/auth_create_role.js +++ b/jstests/concurrency/fsm_workloads/auth_create_role.js @@ -8,7 +8,6 @@ load('jstests/concurrency/fsm_workload_helpers/drop_utils.js'); // for dropRoles var $config = (function() { - var data = { // Use the workload name as a prefix for the role name, // since the workload name is assumed to be unique. @@ -16,7 +15,6 @@ var $config = (function() { }; var states = (function() { - function uniqueRoleName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -45,7 +43,6 @@ var $config = (function() { } return {init: init, createRole: createRole}; - })(); var transitions = {init: {createRole: 1}, createRole: {createRole: 1}}; @@ -63,5 +60,4 @@ var $config = (function() { transitions: transitions, teardown: teardown }; - })(); diff --git a/jstests/concurrency/fsm_workloads/auth_create_user.js b/jstests/concurrency/fsm_workloads/auth_create_user.js index 07fd1135032..2a703c78833 100644 --- a/jstests/concurrency/fsm_workloads/auth_create_user.js +++ b/jstests/concurrency/fsm_workloads/auth_create_user.js @@ -8,7 +8,6 @@ load('jstests/concurrency/fsm_workload_helpers/drop_utils.js'); // for dropUsers var $config = (function() { - var data = { // Use the workload name as a prefix for the username, // since the workload name is assumed to be unique. @@ -16,7 +15,6 @@ var $config = (function() { }; var states = (function() { - function uniqueUsername(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -40,7 +38,6 @@ var $config = (function() { } return {init: init, createUser: createUser}; - })(); var transitions = {init: {createUser: 1}, createUser: {createUser: 1}}; @@ -58,5 +55,4 @@ var $config = (function() { transitions: transitions, teardown: teardown }; - })(); diff --git a/jstests/concurrency/fsm_workloads/auth_drop_role.js b/jstests/concurrency/fsm_workloads/auth_drop_role.js index eba694ccd49..82ae01e58e7 100644 --- a/jstests/concurrency/fsm_workloads/auth_drop_role.js +++ b/jstests/concurrency/fsm_workloads/auth_drop_role.js @@ -9,7 +9,6 @@ load('jstests/concurrency/fsm_workload_helpers/drop_utils.js'); // for dropRoles var $config = (function() { - var data = { // Use the workload name as a prefix for the role name, // since the workload name is assumed to be unique. @@ -17,7 +16,6 @@ var $config = (function() { }; var states = (function() { - function uniqueRoleName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -45,11 +43,9 @@ var $config = (function() { } return {init: init, createAndDropRole: createAndDropRole}; - })(); var transitions = {init: {createAndDropRole: 1}, createAndDropRole: {createAndDropRole: 1}}; return {threadCount: 10, iterations: 20, data: data, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/auth_drop_user.js b/jstests/concurrency/fsm_workloads/auth_drop_user.js index a47d5566874..e8b9c1db4de 100644 --- a/jstests/concurrency/fsm_workloads/auth_drop_user.js +++ b/jstests/concurrency/fsm_workloads/auth_drop_user.js @@ -7,7 +7,6 @@ * drops the user from the database. */ var $config = (function() { - var data = { // Use the workload name as a prefix for the username, // since the workload name is assumed to be unique. @@ -15,7 +14,6 @@ var $config = (function() { }; var states = (function() { - function uniqueUsername(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -38,11 +36,9 @@ var $config = (function() { } return {init: init, createAndDropUser: createAndDropUser}; - })(); var transitions = {init: {createAndDropUser: 1}, createAndDropUser: {createAndDropUser: 1}}; return {threadCount: 10, iterations: 20, data: data, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/collmod.js b/jstests/concurrency/fsm_workloads/collmod.js index 82ddcaba932..15ea365c08e 100644 --- a/jstests/concurrency/fsm_workloads/collmod.js +++ b/jstests/concurrency/fsm_workloads/collmod.js @@ -11,14 +11,12 @@ * All threads update the same TTL index on the same collection. */ var $config = (function() { - var data = { numDocs: 1000, maxTTL: 5000 // max time to live }; var states = (function() { - function collMod(db, collName) { var newTTL = Random.randInt(this.maxTTL); var res = db.runCommand({ @@ -33,7 +31,6 @@ var $config = (function() { } return {collMod: collMod}; - })(); var transitions = {collMod: {collMod: 1}}; @@ -64,5 +61,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/convert_to_capped_collection.js b/jstests/concurrency/fsm_workloads/convert_to_capped_collection.js index 3b906236c5b..6dddc40b49e 100644 --- a/jstests/concurrency/fsm_workloads/convert_to_capped_collection.js +++ b/jstests/concurrency/fsm_workloads/convert_to_capped_collection.js @@ -17,7 +17,6 @@ var $config = (function() { var data = {prefix: 'convert_to_capped_collection'}; var states = (function() { - function uniqueCollectionName(prefix, tid) { return prefix + '_' + tid; } @@ -79,5 +78,4 @@ var $config = (function() { transitions: transitions, setup: setup, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/count.js b/jstests/concurrency/fsm_workloads/count.js index 05315afeb55..1b10482a383 100644 --- a/jstests/concurrency/fsm_workloads/count.js +++ b/jstests/concurrency/fsm_workloads/count.js @@ -14,7 +14,6 @@ load("jstests/libs/fixture_helpers.js"); // For isMongos. var $config = (function() { - var data = { randRange: function randRange(low, high) { // return random number in range [low, high] @@ -31,7 +30,6 @@ var $config = (function() { }; var states = (function() { - function init(db, collName) { this.modulus = this.randRange(5, 10); this.countPerNum = this.randRange(50, 100); @@ -59,11 +57,9 @@ var $config = (function() { } return {init: init, count: count}; - })(); var transitions = {init: {count: 1}, count: {count: 1}}; return {data: data, threadCount: 10, iterations: 20, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/create_capped_collection.js b/jstests/concurrency/fsm_workloads/create_capped_collection.js index 672c369769c..5a74c060919 100644 --- a/jstests/concurrency/fsm_workloads/create_capped_collection.js +++ b/jstests/concurrency/fsm_workloads/create_capped_collection.js @@ -10,7 +10,6 @@ */ var $config = (function() { - // Returns a document of the form { _id: ObjectId(...), field: '...' } // with specified BSON size. function makeDocWithSize(targetSize) { @@ -84,7 +83,6 @@ var $config = (function() { }; var states = (function() { - var options = { capped: true, size: 8192 // multiple of 256; larger than 4096 default @@ -107,7 +105,6 @@ var $config = (function() { } return {init: init, create: create}; - })(); var transitions = {init: {create: 1}, create: {create: 1}}; @@ -119,5 +116,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/create_capped_collection_maxdocs.js b/jstests/concurrency/fsm_workloads/create_capped_collection_maxdocs.js index 8e89a5c63a5..660827f312a 100644 --- a/jstests/concurrency/fsm_workloads/create_capped_collection_maxdocs.js +++ b/jstests/concurrency/fsm_workloads/create_capped_collection_maxdocs.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for e load('jstests/concurrency/fsm_workloads/create_capped_collection.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. $config.data.prefix = 'create_capped_collection_maxdocs'; diff --git a/jstests/concurrency/fsm_workloads/create_collection.js b/jstests/concurrency/fsm_workloads/create_collection.js index 7b851e5b7fb..61db8d10824 100644 --- a/jstests/concurrency/fsm_workloads/create_collection.js +++ b/jstests/concurrency/fsm_workloads/create_collection.js @@ -7,7 +7,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -15,7 +14,6 @@ var $config = (function() { }; var states = (function() { - function uniqueCollectionName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -32,7 +30,6 @@ var $config = (function() { } return {init: init, create: create}; - })(); var transitions = {init: {create: 1}, create: {create: 1}}; @@ -44,5 +41,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/create_database.js b/jstests/concurrency/fsm_workloads/create_database.js index 884c5d442df..573764a98ef 100644 --- a/jstests/concurrency/fsm_workloads/create_database.js +++ b/jstests/concurrency/fsm_workloads/create_database.js @@ -15,7 +15,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isEphemeralForTest var $config = (function() { - let data = { checkCommandResult: function checkCommandResult(mayFailWithDatabaseDifferCase, res) { if (mayFailWithDatabaseDifferCase && !res.ok) @@ -47,7 +46,6 @@ var $config = (function() { this.myDB = db.getSiblingDB(this.uniqueDBName); this.created = false; this.unique = true; - }, useSemiUniqueDBName: function useSemiUniqueDBName(db, collName) { @@ -138,6 +136,8 @@ var $config = (function() { // We only run a few iterations to reduce the amount of data cumulatively // written to disk. threadCount: 10, - iterations: 120, states, transitions, + iterations: 120, + states, + transitions, }; })(); diff --git a/jstests/concurrency/fsm_workloads/create_index_background.js b/jstests/concurrency/fsm_workloads/create_index_background.js index bf5e431531b..9fec0d40a95 100644 --- a/jstests/concurrency/fsm_workloads/create_index_background.js +++ b/jstests/concurrency/fsm_workloads/create_index_background.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongos var $config = (function() { - var data = { nDocumentsToSeed: 1000, nDocumentsToCreate: 200, @@ -46,7 +45,6 @@ var $config = (function() { }; var states = (function() { - function init(db, collName) { // Add thread-specific documents var bulk = db[collName].initializeUnorderedBulkOp(); @@ -187,7 +185,6 @@ var $config = (function() { updateDocs: updateDocs, deleteDocs: deleteDocs }; - })(); var transitions = { @@ -249,5 +246,4 @@ var $config = (function() { teardown: teardown, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/create_index_background_partial_filter.js b/jstests/concurrency/fsm_workloads/create_index_background_partial_filter.js index 08261178b7f..114c726eeee 100644 --- a/jstests/concurrency/fsm_workloads/create_index_background_partial_filter.js +++ b/jstests/concurrency/fsm_workloads/create_index_background_partial_filter.js @@ -27,7 +27,6 @@ var $config = extendWorkload($config, function($config, $super) { }; $config.data.extendDocument = function extendDocument(originalDoc) { - // Be sure we're not overwriting an existing field. assertAlways.eq(originalDoc.hasOwnProperty(fieldName), false); diff --git a/jstests/concurrency/fsm_workloads/create_index_background_unique.js b/jstests/concurrency/fsm_workloads/create_index_background_unique.js index e12c8e59a09..0e147d42321 100644 --- a/jstests/concurrency/fsm_workloads/create_index_background_unique.js +++ b/jstests/concurrency/fsm_workloads/create_index_background_unique.js @@ -9,7 +9,6 @@ */ var $config = (function() { - var data = { prefix: "create_index_background_unique_", numDocsToLoad: 5000, @@ -81,7 +80,6 @@ var $config = (function() { buildIndex: buildIndex, dropIndex: dropIndex, }; - })(); var transitions = { diff --git a/jstests/concurrency/fsm_workloads/create_index_background_unique_capped.js b/jstests/concurrency/fsm_workloads/create_index_background_unique_capped.js index c6f8feb30fa..c1f0da117f2 100644 --- a/jstests/concurrency/fsm_workloads/create_index_background_unique_capped.js +++ b/jstests/concurrency/fsm_workloads/create_index_background_unique_capped.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // load('jstests/concurrency/fsm_workloads/create_index_background_unique.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.prefix = "create_index_background_unique_capped_"; $config.data.getCollectionOptions = function() { // We create an 8MB capped collection, as it will comfortably fit the collection data diff --git a/jstests/concurrency/fsm_workloads/create_index_background_unique_collmod_capped.js b/jstests/concurrency/fsm_workloads/create_index_background_unique_collmod_capped.js index fed8c0cf851..e178ef52cc9 100644 --- a/jstests/concurrency/fsm_workloads/create_index_background_unique_collmod_capped.js +++ b/jstests/concurrency/fsm_workloads/create_index_background_unique_collmod_capped.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/create_index_background_unique_collmod.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.prefix = "create_index_background_unique_collmod_capped_"; $config.data.getCollectionOptions = function() { // We create an 8MB capped collection, as it will comfortably fit the collection data diff --git a/jstests/concurrency/fsm_workloads/database_versioning.js b/jstests/concurrency/fsm_workloads/database_versioning.js index 8759a0f9be5..31b97f5292a 100644 --- a/jstests/concurrency/fsm_workloads/database_versioning.js +++ b/jstests/concurrency/fsm_workloads/database_versioning.js @@ -7,9 +7,7 @@ * @tags: [requires_sharding] */ var $config = (function() { - var states = (function() { - function init(db, collName) { // Dynamically load the shard names for the movePrimary thread to avoid hard-coding // them. @@ -92,7 +90,6 @@ var $config = (function() { } return {init: init, state: state}; - })(); var transitions = {init: {state: 1}, state: {state: 1}}; @@ -144,5 +141,4 @@ var $config = (function() { setup: setup, teardown: teardown, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/distinct.js b/jstests/concurrency/fsm_workloads/distinct.js index 9e58499b9b9..a400d18b29d 100644 --- a/jstests/concurrency/fsm_workloads/distinct.js +++ b/jstests/concurrency/fsm_workloads/distinct.js @@ -9,11 +9,9 @@ */ var $config = (function() { - var data = {numDocs: 1000, prefix: 'distinct_fsm', shardKey: {i: 1}}; var states = (function() { - function init(db, collName) { this.threadCollName = this.prefix + '_' + this.tid; var bulk = db[this.threadCollName].initializeUnorderedBulkOp(); @@ -31,7 +29,6 @@ var $config = (function() { } return {init: init, distinct: distinct}; - })(); var transitions = {init: {distinct: 1}, distinct: {distinct: 1}}; @@ -43,5 +40,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/distinct_noindex.js b/jstests/concurrency/fsm_workloads/distinct_noindex.js index 3727c968a14..1848fe78901 100644 --- a/jstests/concurrency/fsm_workloads/distinct_noindex.js +++ b/jstests/concurrency/fsm_workloads/distinct_noindex.js @@ -8,7 +8,6 @@ * Each thread operates on the same collection. */ var $config = (function() { - var data = { randRange: function randRange(low, high) { assertAlways.gt(high, low); @@ -18,7 +17,6 @@ var $config = (function() { }; var states = (function() { - function init(db, collName) { this.modulus = this.randRange(5, 15); @@ -36,11 +34,9 @@ var $config = (function() { } return {init: init, distinct: distinct}; - })(); var transitions = {init: {distinct: 1}, distinct: {distinct: 1}}; return {data: data, threadCount: 10, iterations: 20, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/drop_collection.js b/jstests/concurrency/fsm_workloads/drop_collection.js index 66fa7539de2..950c9f3d5ed 100644 --- a/jstests/concurrency/fsm_workloads/drop_collection.js +++ b/jstests/concurrency/fsm_workloads/drop_collection.js @@ -6,7 +6,6 @@ * Repeatedly creates and drops a collection. */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -14,7 +13,6 @@ var $config = (function() { }; var states = (function() { - function uniqueCollectionName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -31,7 +29,6 @@ var $config = (function() { } return {init: init, createAndDrop: createAndDrop}; - })(); var transitions = {init: {createAndDrop: 1}, createAndDrop: {createAndDrop: 1}}; @@ -45,5 +42,4 @@ var $config = (function() { // The threadCount and iterations can be increased once PM-697 ("Remove all usages of // distributed lock") is complete. return {threadCount: 5, iterations: 5, data: data, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/drop_database.js b/jstests/concurrency/fsm_workloads/drop_database.js index 3a87701b086..8a13461bb09 100644 --- a/jstests/concurrency/fsm_workloads/drop_database.js +++ b/jstests/concurrency/fsm_workloads/drop_database.js @@ -6,7 +6,6 @@ * Repeatedly creates and drops a database. */ var $config = (function() { - var states = { init: function init(db, collName) { this.uniqueDBName = db.getName() + 'drop_database' + this.tid; @@ -27,5 +26,4 @@ var $config = (function() { var transitions = {init: {createAndDrop: 1}, createAndDrop: {createAndDrop: 1}}; return {threadCount: 10, iterations: 20, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/drop_index_during_replan.js b/jstests/concurrency/fsm_workloads/drop_index_during_replan.js index 637fbbd4954..3444b8eac33 100644 --- a/jstests/concurrency/fsm_workloads/drop_index_during_replan.js +++ b/jstests/concurrency/fsm_workloads/drop_index_during_replan.js @@ -9,7 +9,6 @@ * index drops. */ var $config = (function() { - let data = { collName: 'drop_index_during_replan', indexSpecs: [ @@ -75,5 +74,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/explain.js b/jstests/concurrency/fsm_workloads/explain.js index 7a65411798c..7eb5483d9f5 100644 --- a/jstests/concurrency/fsm_workloads/explain.js +++ b/jstests/concurrency/fsm_workloads/explain.js @@ -9,7 +9,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongod var $config = (function() { - var data = { collNotExist: 'donotexist__', nInserted: 0, @@ -52,7 +51,6 @@ var $config = (function() { } return {insert: insert, explain: explain, explainNonExistentNS: explainNonExistentNS}; - })(); var transitions = { diff --git a/jstests/concurrency/fsm_workloads/explain_aggregate.js b/jstests/concurrency/fsm_workloads/explain_aggregate.js index 5aa776ab84b..38370a4e346 100644 --- a/jstests/concurrency/fsm_workloads/explain_aggregate.js +++ b/jstests/concurrency/fsm_workloads/explain_aggregate.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/explain.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - function assertCursorStages(num, obj) { assertAlways(obj.stages, tojson(obj)); assertAlways.eq(num, obj.stages.length, tojson(obj.stages)); diff --git a/jstests/concurrency/fsm_workloads/explain_count.js b/jstests/concurrency/fsm_workloads/explain_count.js index 920b12ab9b6..6e30cd442da 100644 --- a/jstests/concurrency/fsm_workloads/explain_count.js +++ b/jstests/concurrency/fsm_workloads/explain_count.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMong load('jstests/libs/analyze_plan.js'); // for planHasStage var $config = extendWorkload($config, function($config, $super) { - function assertNCounted(num, obj, db) { var stage = obj.executionStats.executionStages; // get sharded stage(s) if counting on mongos diff --git a/jstests/concurrency/fsm_workloads/explain_find.js b/jstests/concurrency/fsm_workloads/explain_find.js index 434fb3aa041..ac39881e4d8 100644 --- a/jstests/concurrency/fsm_workloads/explain_find.js +++ b/jstests/concurrency/fsm_workloads/explain_find.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_workloads/explain.js'); // for $config load('jstests/libs/analyze_plan.js'); // for planHasStage and isIxscan var $config = extendWorkload($config, function($config, $super) { - $config.states = Object.extend({ explainLimit: function explainLimit(db, collName) { var res = db[collName].find().limit(3).explain(); diff --git a/jstests/concurrency/fsm_workloads/explain_remove.js b/jstests/concurrency/fsm_workloads/explain_remove.js index 971a39030c6..d74693d7f93 100644 --- a/jstests/concurrency/fsm_workloads/explain_remove.js +++ b/jstests/concurrency/fsm_workloads/explain_remove.js @@ -9,7 +9,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/explain.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states = Object.extend({ explainSingleRemove: function explainSingleRemove(db, collName) { var res = db[collName] diff --git a/jstests/concurrency/fsm_workloads/explain_update.js b/jstests/concurrency/fsm_workloads/explain_update.js index 92e39f13adc..63d89428942 100644 --- a/jstests/concurrency/fsm_workloads/explain_update.js +++ b/jstests/concurrency/fsm_workloads/explain_update.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_workloads/explain.js'); // for $confi load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongos var $config = extendWorkload($config, function($config, $super) { - $config.states = Object.extend({ explainBasicUpdate: function explainBasicUpdate(db, collName) { var res = diff --git a/jstests/concurrency/fsm_workloads/findAndModify_inc.js b/jstests/concurrency/fsm_workloads/findAndModify_inc.js index 7612d91280f..501aed05be6 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_inc.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_inc.js @@ -85,5 +85,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js b/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js index 19cd191b1aa..9be47a02525 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_mixed_queue_unindexed.js @@ -22,7 +22,6 @@ load('jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js'); // for load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the database name, since the workload name is assumed to be // unique. $config.data.uniqueDBName = 'findAndModify_mixed_queue_unindexed'; @@ -81,7 +80,6 @@ var $config = extendWorkload($config, function($config, $super) { remove: remove, update: update, }; - })(); $config.transitions = { diff --git a/jstests/concurrency/fsm_workloads/findAndModify_remove.js b/jstests/concurrency/fsm_workloads/findAndModify_remove.js index b4a32a3cc74..bcca3834c52 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_remove.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_remove.js @@ -7,11 +7,9 @@ * the findAndModify command to remove it. */ var $config = (function() { - var data = {shardKey: {tid: 1}}; var states = (function() { - function init(db, collName) { this.iter = 0; } @@ -41,11 +39,9 @@ var $config = (function() { } return {init: init, insertAndRemove: insertAndRemove}; - })(); var transitions = {init: {insertAndRemove: 1}, insertAndRemove: {insertAndRemove: 1}}; return {threadCount: 20, iterations: 20, data: data, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js index 9b945468cf5..c97ac6eb10a 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js @@ -15,7 +15,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - var data = { // Use the workload name as the database name, since the workload name is assumed to be // unique. @@ -57,7 +56,6 @@ var $config = (function() { }; var states = (function() { - function remove(db, collName) { var res = db.runCommand( {findAndModify: db[collName].getName(), query: {}, sort: {rand: -1}, remove: true}); @@ -78,7 +76,6 @@ var $config = (function() { } return {remove: remove}; - })(); var transitions = {remove: {remove: 1}}; @@ -194,5 +191,4 @@ var $config = (function() { setup: setup, teardown: teardown }; - })(); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue_unindexed.js b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue_unindexed.js index 387c5467f04..981568904ad 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_remove_queue_unindexed.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_remove_queue_unindexed.js @@ -17,7 +17,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for load('jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the database name, since the workload // name is assumed to be unique. $config.data.uniqueDBName = 'findAndModify_remove_queue_unindexed'; diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update.js b/jstests/concurrency/fsm_workloads/findAndModify_update.js index 16aa80b8a33..03e391409ae 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update.js @@ -9,14 +9,12 @@ * using either the $min or $max operator. */ var $config = (function() { - var data = { numDocsPerThread: 3, // >1 for 'sort' to be meaningful shardKey: {tid: 1} }; var states = (function() { - function makeDoc(tid) { return {_id: new ObjectId(), tid: tid, value: 0}; } @@ -76,7 +74,6 @@ var $config = (function() { findAndModifyAscending: findAndModifyAscending, findAndModifyDescending: findAndModifyDescending }; - })(); var transitions = { @@ -98,5 +95,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update_collscan.js b/jstests/concurrency/fsm_workloads/findAndModify_update_collscan.js index d1c8134bd39..aba96be9648 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update_collscan.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update_collscan.js @@ -14,7 +14,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for exten load('jstests/concurrency/fsm_workloads/findAndModify_update.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Do not create the { tid: 1, value: 1 } index so that a // collection // scan is performed for the query and sort operations. diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js b/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js index fd49788830c..68de0be1cc1 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update_grow.js @@ -13,13 +13,11 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongod var $config = (function() { - var data = { shardKey: {tid: 1}, }; var states = (function() { - // Use the workload name as the field name (since it is assumed // to be unique) to avoid any potential issues with large keys // and indexes on the collection. @@ -109,7 +107,6 @@ var $config = (function() { insert: insert, findAndModify: findAndModify, }; - })(); var transitions = {insert: {findAndModify: 1}, findAndModify: {findAndModify: 1}}; @@ -122,5 +119,4 @@ var $config = (function() { startState: 'insert', transitions: transitions }; - })(); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js b/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js index 1d82f4b7eb2..550ad25c809 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update_queue.js @@ -18,7 +18,6 @@ load('jstests/concurrency/fsm_workloads/findAndModify_remove_queue.js'); // for load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the database name, since the workload name is assumed to be // unique. $config.data.uniqueDBName = 'findAndModify_update_queue'; @@ -34,7 +33,6 @@ var $config = extendWorkload($config, function($config, $super) { $config.data.opName = 'updated'; var states = (function() { - function update(db, collName) { // Update the counter field to avoid matching the same document again. var res = db.runCommand({ @@ -61,7 +59,6 @@ var $config = extendWorkload($config, function($config, $super) { } return {update: update}; - })(); var transitions = {update: {update: 1}}; diff --git a/jstests/concurrency/fsm_workloads/findAndModify_update_queue_unindexed.js b/jstests/concurrency/fsm_workloads/findAndModify_update_queue_unindexed.js index cda9a494a61..c70b80058f0 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_update_queue_unindexed.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_update_queue_unindexed.js @@ -17,7 +17,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for load('jstests/concurrency/fsm_workloads/findAndModify_update_queue.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the database name, since the workload // name is assumed to be unique. $config.data.uniqueDBName = 'findAndModify_update_queue_unindexed'; diff --git a/jstests/concurrency/fsm_workloads/findAndModify_upsert.js b/jstests/concurrency/fsm_workloads/findAndModify_upsert.js index e79b5322bc4..e9b06e7afb7 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_upsert.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_upsert.js @@ -9,11 +9,9 @@ * $push operator. */ var $config = (function() { - var data = {sort: false, shardKey: {tid: 1}}; var states = (function() { - // Returns true if the specified array is sorted in ascending order, // and false otherwise. function isSorted(arr) { @@ -101,7 +99,6 @@ var $config = (function() { } return {init: init, upsert: upsert, update: update}; - })(); var transitions = { @@ -111,5 +108,4 @@ var $config = (function() { }; return {threadCount: 20, iterations: 20, data: data, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/findAndModify_upsert_collscan.js b/jstests/concurrency/fsm_workloads/findAndModify_upsert_collscan.js index 8751e99fd21..0cbfbd3ab21 100644 --- a/jstests/concurrency/fsm_workloads/findAndModify_upsert_collscan.js +++ b/jstests/concurrency/fsm_workloads/findAndModify_upsert_collscan.js @@ -14,7 +14,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for exten load('jstests/concurrency/fsm_workloads/findAndModify_upsert.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.sort = {$natural: 1}; return $config; diff --git a/jstests/concurrency/fsm_workloads/globally_managed_cursors.js b/jstests/concurrency/fsm_workloads/globally_managed_cursors.js index 67ee596e782..42e4abfa3e2 100644 --- a/jstests/concurrency/fsm_workloads/globally_managed_cursors.js +++ b/jstests/concurrency/fsm_workloads/globally_managed_cursors.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/kill_multicollection_aggregation.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states.listCollections = function listCollections(unusedDB, _) { const db = unusedDB.getSiblingDB(this.uniqueDBName); const cmdRes = diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_1char.js b/jstests/concurrency/fsm_workloads/indexed_insert_1char.js index 54fe0662cb4..b264b6561a5 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_1char.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_1char.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_1char'; $config.data.shardKey = {}; $config.data.shardKey[$config.data.indexedField] = 1; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_2d.js b/jstests/concurrency/fsm_workloads/indexed_insert_2d.js index a461f9cb310..d4ec75e992d 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_2d.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_2d.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_2d'; // Remove the shard key for 2d indexes, as they are not supported delete $config.data.shardKey; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_2dsphere.js b/jstests/concurrency/fsm_workloads/indexed_insert_2dsphere.js index 40134e97840..20ac7b4b588 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_2dsphere.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_2dsphere.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/indexed_insert_2d.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_2dsphere'; $config.data.getIndexSpec = function getIndexSpec() { diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_base.js b/jstests/concurrency/fsm_workloads/indexed_insert_base.js index b48ac0fbf1d..6b44042e59f 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_base.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_base.js @@ -8,7 +8,6 @@ * value is the thread's id. */ var $config = (function() { - function makeSortSpecFromIndexSpec(ixSpec) { var sort = {}; @@ -102,5 +101,4 @@ var $config = (function() { }, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_compound.js b/jstests/concurrency/fsm_workloads/indexed_insert_compound.js index c704b6dd0bc..b7a9b761b89 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_compound.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_compound.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states.init = function init(db, collName) { $super.states.init.apply(this, arguments); }; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_heterogeneous.js b/jstests/concurrency/fsm_workloads/indexed_insert_heterogeneous.js index b486120185d..5306facb834 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_heterogeneous.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_heterogeneous.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_heterogeneous'; $config.data.shardKey = {}; $config.data.shardKey[$config.data.indexedField] = 1; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_large.js b/jstests/concurrency/fsm_workloads/indexed_insert_large.js index cb2dbf58b21..55dd1daf4dc 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_large.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_large.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_large'; // Remove the shard key, since it cannot be greater than 512 bytes diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_long_fieldname.js b/jstests/concurrency/fsm_workloads/indexed_insert_long_fieldname.js index c5cc3af152d..06e92f5907f 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_long_fieldname.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_long_fieldname.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // The indexedField must be limited such that the namespace and indexedField does not // exceed 128 characters. The namespace defaults to // "test<i>_fsmdb<j>.fsmcoll<k>", // where i, j & k are increasing integers for each test, workload and thread. diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_multikey.js b/jstests/concurrency/fsm_workloads/indexed_insert_multikey.js index 34c28db22eb..4343de2d2be 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_multikey.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_multikey.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_multikey'; // Remove the shard key, since it cannot be a multikey index delete $config.data.shardKey; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_ordered_bulk.js b/jstests/concurrency/fsm_workloads/indexed_insert_ordered_bulk.js index 38998cd9f59..4fc72a6cd0c 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_ordered_bulk.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_ordered_bulk.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_ordered_bulk'; $config.data.shardKey = {}; $config.data.shardKey[$config.data.indexedField] = 1; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_text.js b/jstests/concurrency/fsm_workloads/indexed_insert_text.js index 82e0feb09a8..7967bd30811 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_text.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_text.js @@ -6,7 +6,6 @@ * Inserts some documents into a collection with a text index. */ var $config = (function() { - var states = { init: function init(db, collName) { // noop @@ -126,5 +125,4 @@ var $config = (function() { }, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_text_multikey.js b/jstests/concurrency/fsm_workloads/indexed_insert_text_multikey.js index b527ef016f8..a665b7e61ac 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_text_multikey.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_text_multikey.js @@ -9,7 +9,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_text.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states.init = function init(db, collName) { $super.states.init.apply(this, arguments); }; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_ttl.js b/jstests/concurrency/fsm_workloads/indexed_insert_ttl.js index 2b0afd43d96..4cb203311ca 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_ttl.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_ttl.js @@ -9,7 +9,6 @@ * doc inserted by each thread is no longer in the collection. */ var $config = (function() { - var states = { init: function init(db, collName) { var res = db[collName].insert({indexed_insert_ttl: new ISODate(), first: true}); diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_unordered_bulk.js b/jstests/concurrency/fsm_workloads/indexed_insert_unordered_bulk.js index 3c1ea8f0ea0..233f630a8b4 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_unordered_bulk.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_unordered_bulk.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_unordered_bulk'; $config.data.shardKey = {}; $config.data.shardKey[$config.data.indexedField] = 1; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_upsert.js b/jstests/concurrency/fsm_workloads/indexed_insert_upsert.js index bc1b65e9597..e4b59b5c3af 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_upsert.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_upsert.js @@ -14,7 +14,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/indexed_insert_base.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.indexedField = 'indexed_insert_upsert'; $config.data.shardKey = {}; $config.data.shardKey[$config.data.indexedField] = 1; diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_where.js b/jstests/concurrency/fsm_workloads/indexed_insert_where.js index e5d2a98b8c5..b44967d3550 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_where.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_where.js @@ -10,7 +10,6 @@ */ var $config = (function() { - var data = { documentsToInsert: 100, insertedDocuments: 0, diff --git a/jstests/concurrency/fsm_workloads/indexed_insert_wildcard.js b/jstests/concurrency/fsm_workloads/indexed_insert_wildcard.js index c1f08b7a876..3c22b636faf 100644 --- a/jstests/concurrency/fsm_workloads/indexed_insert_wildcard.js +++ b/jstests/concurrency/fsm_workloads/indexed_insert_wildcard.js @@ -23,8 +23,7 @@ var $config = extendWorkload($config, function($config, $super) { threadIdInArray: [this.tid], nestedThreadId: {threadId: this.tid}, arrayField: [this.tid, "a string", [1, 2, 3]], - fieldWithNestedObject: - {nestedDoc: {subNestedDoc: {leaf: "a string"}}, leaf: "a string"} + fieldWithNestedObject: {nestedDoc: {subNestedDoc: {leaf: "a string"}}, leaf: "a string"} }; }; diff --git a/jstests/concurrency/fsm_workloads/invalidated_cursors.js b/jstests/concurrency/fsm_workloads/invalidated_cursors.js index 777ee30eab1..58a3f007aaa 100644 --- a/jstests/concurrency/fsm_workloads/invalidated_cursors.js +++ b/jstests/concurrency/fsm_workloads/invalidated_cursors.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongos var $config = (function() { - let data = { chooseRandomlyFrom: function chooseRandomlyFrom(arr) { if (!Array.isArray(arr)) { @@ -162,11 +161,11 @@ var $config = (function() { // killOp. assertAlways.contains(e.code, [ - ErrorCodes.OperationFailed, - ErrorCodes.QueryPlanKilled, - ErrorCodes.CursorNotFound, - ErrorCodes.CursorKilled, - ErrorCodes.Interrupted, + ErrorCodes.OperationFailed, + ErrorCodes.QueryPlanKilled, + ErrorCodes.CursorNotFound, + ErrorCodes.CursorKilled, + ErrorCodes.Interrupted, ], 'unexpected error code: ' + e.code + ': ' + e.message); } diff --git a/jstests/concurrency/fsm_workloads/kill_aggregation.js b/jstests/concurrency/fsm_workloads/kill_aggregation.js index 3b4e46b4b12..e3dcc312600 100644 --- a/jstests/concurrency/fsm_workloads/kill_aggregation.js +++ b/jstests/concurrency/fsm_workloads/kill_aggregation.js @@ -14,7 +14,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkl load('jstests/concurrency/fsm_workloads/kill_rooted_or.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the collection name, since the workload name is assumed to be // unique. Note that we choose our own collection name instead of using the collection provided // by the concurrency framework, because this workload drops its collection. diff --git a/jstests/concurrency/fsm_workloads/kill_multicollection_aggregation.js b/jstests/concurrency/fsm_workloads/kill_multicollection_aggregation.js index 6db7689ad3b..0cbc7193f17 100644 --- a/jstests/concurrency/fsm_workloads/kill_multicollection_aggregation.js +++ b/jstests/concurrency/fsm_workloads/kill_multicollection_aggregation.js @@ -16,7 +16,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extend load('jstests/concurrency/fsm_workloads/invalidated_cursors.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /** * Runs the specified aggregation pipeline and stores the resulting cursor (if the command * is successful) in 'this.cursor'. diff --git a/jstests/concurrency/fsm_workloads/kill_rooted_or.js b/jstests/concurrency/fsm_workloads/kill_rooted_or.js index 6f6e72bb67f..7cd4abdd735 100644 --- a/jstests/concurrency/fsm_workloads/kill_rooted_or.js +++ b/jstests/concurrency/fsm_workloads/kill_rooted_or.js @@ -10,7 +10,6 @@ * This workload was designed to reproduce SERVER-24761. */ var $config = (function() { - // Use the workload name as the collection name, since the workload name is assumed to be // unique. Note that we choose our own collection name instead of using the collection provided // by the concurrency framework, because this workload drops its collection. @@ -110,5 +109,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/list_indexes.js b/jstests/concurrency/fsm_workloads/list_indexes.js index 17726286473..ba5549e1e68 100644 --- a/jstests/concurrency/fsm_workloads/list_indexes.js +++ b/jstests/concurrency/fsm_workloads/list_indexes.js @@ -7,7 +7,6 @@ * index catalog. */ var $config = (function() { - var states = (function() { // Picks a random index to drop and recreate. function modifyIndices(db, collName) { diff --git a/jstests/concurrency/fsm_workloads/map_reduce_drop.js b/jstests/concurrency/fsm_workloads/map_reduce_drop.js index 17900fb74a1..9066bca8375 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_drop.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_drop.js @@ -17,7 +17,6 @@ * ] */ var $config = (function() { - var data = { mapper: function mapper() { emit(this.key, 1); @@ -31,7 +30,6 @@ var $config = (function() { }; var states = (function() { - function dropColl(db, collName) { var mapReduceDb = db.getSiblingDB(this.mapReduceDBName); @@ -78,7 +76,6 @@ var $config = (function() { } return {dropColl: dropColl, dropDB: dropDB, mapReduce: mapReduce}; - })(); var transitions = { @@ -100,5 +97,4 @@ var $config = (function() { startState: 'mapReduce', transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/map_reduce_inline.js b/jstests/concurrency/fsm_workloads/map_reduce_inline.js index 22589f1afad..203fecbe6a8 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_inline.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_inline.js @@ -14,7 +14,6 @@ * ] */ var $config = (function() { - function mapper() { if (this.hasOwnProperty('key') && this.hasOwnProperty('value')) { var obj = {}; @@ -45,7 +44,6 @@ var $config = (function() { var data = {numDocs: 2000, mapper: mapper, reducer: reducer, finalizer: finalizer}; var states = (function() { - function init(db, collName) { // no-op // other workloads that extend this workload use this method @@ -59,7 +57,6 @@ var $config = (function() { } return {init: init, mapReduce: mapReduce}; - })(); var transitions = {init: {mapReduce: 1}, mapReduce: {mapReduce: 1}}; @@ -93,5 +90,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/map_reduce_merge.js b/jstests/concurrency/fsm_workloads/map_reduce_merge.js index 125a2b35261..2af72dca1a3 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_merge.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_merge.js @@ -21,7 +21,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the database name, // since the workload name is assumed to be unique. var uniqueDBName = 'map_reduce_merge'; diff --git a/jstests/concurrency/fsm_workloads/map_reduce_merge_nonatomic.js b/jstests/concurrency/fsm_workloads/map_reduce_merge_nonatomic.js index 32b324b08bf..ffe5a4fa8fd 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_merge_nonatomic.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_merge_nonatomic.js @@ -21,7 +21,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as a prefix for the database name, // since the workload name is assumed to be unique. var prefix = 'map_reduce_merge_nonatomic'; diff --git a/jstests/concurrency/fsm_workloads/map_reduce_reduce.js b/jstests/concurrency/fsm_workloads/map_reduce_reduce.js index 4cb9d8241ca..86d3733df9c 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_reduce.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_reduce.js @@ -19,7 +19,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. var prefix = 'map_reduce_reduce'; diff --git a/jstests/concurrency/fsm_workloads/map_reduce_reduce_nonatomic.js b/jstests/concurrency/fsm_workloads/map_reduce_reduce_nonatomic.js index 286e2023c66..772eb6cd13f 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_reduce_nonatomic.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_reduce_nonatomic.js @@ -22,7 +22,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as the collection name, // since the workload name is assumed to be unique. var uniqueCollectionName = 'map_reduce_reduce_nonatomic'; diff --git a/jstests/concurrency/fsm_workloads/map_reduce_replace.js b/jstests/concurrency/fsm_workloads/map_reduce_replace.js index 0eda604b7ec..ec707fbbe53 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_replace.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_replace.js @@ -19,7 +19,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. var prefix = 'map_reduce_replace'; diff --git a/jstests/concurrency/fsm_workloads/map_reduce_replace_nonexistent.js b/jstests/concurrency/fsm_workloads/map_reduce_replace_nonexistent.js index 623a7b2a936..51b962f7561 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_replace_nonexistent.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_replace_nonexistent.js @@ -18,7 +18,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWo load('jstests/concurrency/fsm_workloads/map_reduce_inline.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. $config.data.prefix = 'map_reduce_replace_nonexistent'; diff --git a/jstests/concurrency/fsm_workloads/map_reduce_replace_remove.js b/jstests/concurrency/fsm_workloads/map_reduce_replace_remove.js index bf9768d9639..59c6870b7b5 100644 --- a/jstests/concurrency/fsm_workloads/map_reduce_replace_remove.js +++ b/jstests/concurrency/fsm_workloads/map_reduce_replace_remove.js @@ -19,7 +19,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendW load('jstests/concurrency/fsm_workloads/map_reduce_replace.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states.remove = function remove(db, collName) { for (var i = 0; i < 20; ++i) { var res = db[collName].remove({value: {$gte: Random.randInt(this.numDocs / 10)}}, diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js index 0a6d74b51d9..81cc596e228 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands.js @@ -7,7 +7,6 @@ */ load('jstests/concurrency/fsm_workload_helpers/cleanup_txns.js'); var $config = (function() { - function quietly(func) { const printOriginal = print; try { @@ -216,5 +215,4 @@ var $config = (function() { setup: setup, teardown: teardown }; - })(); diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands_same_session.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands_same_session.js index 11aaac9cdac..2ecd324f04d 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands_same_session.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands_same_session.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_workloads/multi_statement_transaction_all_commands // $config var $config = extendWorkload($config, function($config, $super) { - $config.setup = function(db, collName, cluster) { $super.setup.apply(this, arguments); this.lsid = tojson({id: UUID()}); diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation.js index 56a8b5d3a13..79e9f3efd11 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation.js @@ -53,7 +53,6 @@ load('jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js'); load("jstests/aggregation/extras/utils.js"); var $config = (function() { - function checkTransactionCommitOrder(documents) { const graph = new Graph(); @@ -95,9 +94,7 @@ var $config = (function() { } } - for (let { - op, actual - } of updateCounts.values()) { + for (let {op, actual} of updateCounts.values()) { assert.eq(op.numUpdated, actual, () => { return 'transaction ' + tojson(op) + ' should have updated ' + op.numUpdated + ' documents, but ' + actual + ' were updated: ' + tojson(updateCounts.values()); @@ -174,8 +171,8 @@ var $config = (function() { assertWhenOwnColl.eq(allDocuments.length, numDocs * this.collections.length, () => { if (this.session) { return "txnNumber: " + tojson(this.session.getTxnNumber_forTesting()) + - ", session id: " + tojson(this.session.getSessionId()) + ", all documents: " + - tojson(allDocuments); + ", session id: " + tojson(this.session.getSessionId()) + + ", all documents: " + tojson(allDocuments); } return "all documents: " + tojson(allDocuments); }); @@ -192,7 +189,6 @@ var $config = (function() { } const states = (function() { - return { init: function init(db, collName) { this.iteration = 0; @@ -367,5 +363,4 @@ var $config = (function() { setup: setup, teardown: teardown, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_metrics_test.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_metrics_test.js index 96f25774664..b4e22f46dc2 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_metrics_test.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_metrics_test.js @@ -13,7 +13,6 @@ load('jstests/core/txns/libs/prepare_helpers.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /** * Returns all elements in the given array that evaluate to false for the given predicate * function 'predFn'. @@ -163,7 +162,6 @@ var $config = extendWorkload($config, function($config, $super) { }; $config.states.checkInvariants = function checkInvariants(db, collName) { - // Check server-wide invariants using 100 samples. This sample size is deemed big enough to // account for transient inconsistencies, which we assume are rare. let nSamples = 100; @@ -179,7 +177,6 @@ var $config = extendWorkload($config, function($config, $super) { let timeOpen = Number(txnStats["timeOpenMicros"]); assertAlways.eq(timeActive + timeInactive, timeOpen, () => tojson(txnStats)); }); - }; $config.transitions = { diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_multi_db.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_multi_db.js index 417cf05aa41..7946b83b2a2 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_multi_db.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_multi_db.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation.js'); var $config = extendWorkload($config, ($config, $super) => { - // Number of unique collections and number of unique databases. The square root is used // here to ensure the total number of namespaces (coll * db) is roughly equal to the // number of threads. diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_repeated_reads.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_repeated_reads.js index 877016bea2b..72661493d5d 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_repeated_reads.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_isolation_repeated_reads.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_workloads/multi_statement_transaction_atomicity_is // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.numReads = 5; $config.states.repeatedRead = function repeatedRead(db, collName) { @@ -26,17 +25,17 @@ var $config = extendWorkload($config, function($config, $super) { const collectionDocs = collection.find().batchSize(batchSize).toArray(); assertWhenOwnColl.eq(this.numDocs, collectionDocs.length, () => { return "txnNumber: " + tojson(this.session.getTxnNumber_forTesting()) + - ", session id: " + tojson(this.session.getSessionId()) + ", read number: " + - i + ", collection docs: " + tojson(collectionDocs); + ", session id: " + tojson(this.session.getSessionId()) + + ", read number: " + i + ", collection docs: " + tojson(collectionDocs); }); if (prevDocuments) { - assertAlways.sameMembers(prevDocuments, - collectionDocs, - () => "Document mismatch - previous documents: " + - tojsononeline(prevDocuments) + - ", current documents: " + - tojsononeline(collectionDocs), - bsonBinaryEqual); // Exact document matches. + assertAlways.sameMembers( + prevDocuments, + collectionDocs, + () => "Document mismatch - previous documents: " + + tojsononeline(prevDocuments) + + ", current documents: " + tojsononeline(collectionDocs), + bsonBinaryEqual); // Exact document matches. } prevDocuments = collectionDocs; } diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple.js index 27c3cef5181..adf4feba8b0 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple.js @@ -12,13 +12,11 @@ load('jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js'); var $config = (function() { - function computeTotalOfAllBalances(documents) { return documents.reduce((total, account) => total + account.balance, 0); } var states = (function() { - function getAllDocuments(session, collection, numDocs, txnHelperOptions) { let documents; withTxnAndAutoRetry(session, () => { @@ -119,5 +117,4 @@ var $config = (function() { setup: setup, teardown: teardown }; - })(); diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_majority_writes.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_majority_writes.js index 2e52765014c..0c097015c46 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_majority_writes.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_majority_writes.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_workloads/multi_statement_transaction_simple.js'); load('jstests/concurrency/fsm_workload_helpers/server_types.js'); // for isMongos var $config = extendWorkload($config, function($config, $super) { - $config.data.majorityWriteCollName = 'majority_writes'; $config.data.counter = 0; diff --git a/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_repeated_reads.js b/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_repeated_reads.js index a6a821e207a..93d89bbce0f 100644 --- a/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_repeated_reads.js +++ b/jstests/concurrency/fsm_workloads/multi_statement_transaction_simple_repeated_reads.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/multi_statement_transaction_simple.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.data.numReads = 5; $config.states.repeatedRead = function repeatedRead(db, collName) { @@ -22,13 +21,13 @@ var $config = extendWorkload($config, function($config, $super) { assertWhenOwnColl.eq( this.numAccounts, collectionDocs.length, () => tojson(collectionDocs)); if (prevDocuments) { - assertAlways.sameMembers(prevDocuments, - collectionDocs, - () => "Document mismatch - previous documents: " + - tojsononeline(prevDocuments) + - ", current documents: " + - tojsononeline(collectionDocs), - bsonBinaryEqual); // Exact document matches. + assertAlways.sameMembers( + prevDocuments, + collectionDocs, + () => "Document mismatch - previous documents: " + + tojsononeline(prevDocuments) + + ", current documents: " + tojsononeline(collectionDocs), + bsonBinaryEqual); // Exact document matches. } prevDocuments = collectionDocs; } diff --git a/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js b/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js index a744c6b888a..1ab8a48212c 100644 --- a/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js +++ b/jstests/concurrency/fsm_workloads/plan_cache_drop_database.js @@ -9,7 +9,6 @@ * the updating of said object's PlanCache (SERVER-17117). */ var $config = (function() { - function populateData(db, collName) { var coll = db[collName]; @@ -28,7 +27,6 @@ var $config = (function() { } var states = (function() { - function count(db, collName) { var coll = db.getSiblingDB(this.planCacheDBName)[collName]; @@ -52,7 +50,6 @@ var $config = (function() { } return {count: count, dropDB: dropDB}; - })(); var transitions = {count: {count: 0.95, dropDB: 0.05}, dropDB: {count: 0.95, dropDB: 0.05}}; @@ -72,5 +69,4 @@ var $config = (function() { transitions: transitions, setup: setup, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_base.js b/jstests/concurrency/fsm_workloads/random_moveChunk_base.js index bbafcd93a94..866d21a6b72 100644 --- a/jstests/concurrency/fsm_workloads/random_moveChunk_base.js +++ b/jstests/concurrency/fsm_workloads/random_moveChunk_base.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); load('jstests/concurrency/fsm_workloads/sharded_base_partitioned.js'); var $config = extendWorkload($config, function($config, $super) { - $config.threadCount = 1; $config.iterations = 1; diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_delete_transaction.js b/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_delete_transaction.js index e4a80f533a6..6f62354216f 100644 --- a/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_delete_transaction.js +++ b/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_delete_transaction.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_workloads/random_moveChunk_base.js'); load('jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js'); var $config = extendWorkload($config, function($config, $super) { - $config.threadCount = 5; $config.iterations = 50; @@ -122,8 +121,8 @@ var $config = extendWorkload($config, function($config, $super) { $config.states.verifyDocuments = function verifyDocuments(db, collName, connCache) { const docs = db[collName].find({tid: this.tid}).toArray(); assertWhenOwnColl.eq(this.expectedDocuments.length, docs.length, () => { - return 'unexpected number of documents, docs: ' + tojson(docs) + ', expected docs: ' + - tojson(this.expectedDocuments); + return 'unexpected number of documents, docs: ' + tojson(docs) + + ', expected docs: ' + tojson(this.expectedDocuments); }); // Verify only the documents we haven't tried to delete were found. diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_update_transaction.js b/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_update_transaction.js index c3e6fedba5c..706657b9631 100644 --- a/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_update_transaction.js +++ b/jstests/concurrency/fsm_workloads/random_moveChunk_broadcast_update_transaction.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_workloads/random_moveChunk_base.js'); load('jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js'); var $config = extendWorkload($config, function($config, $super) { - $config.threadCount = 5; $config.iterations = 50; diff --git a/jstests/concurrency/fsm_workloads/random_moveChunk_update_shard_key.js b/jstests/concurrency/fsm_workloads/random_moveChunk_update_shard_key.js index 0fcafa31ca6..0b22a7909a9 100644 --- a/jstests/concurrency/fsm_workloads/random_moveChunk_update_shard_key.js +++ b/jstests/concurrency/fsm_workloads/random_moveChunk_update_shard_key.js @@ -12,7 +12,6 @@ load('jstests/concurrency/fsm_workloads/random_moveChunk_base.js'); load('jstests/concurrency/fsm_workload_helpers/auto_retry_transaction.js'); var $config = extendWorkload($config, function($config, $super) { - $config.threadCount = 5; $config.iterations = 50; @@ -149,10 +148,10 @@ var $config = extendWorkload($config, function($config, $super) { : " as a retryable write. "; logString += "The document will "; logString += moveAcrossChunks ? "move across chunks. " : "stay within the same chunk. \n"; - logString += "Original document values -- id: " + idToUpdate + ", shardKey: " + - currentShardKey + ", counter: " + counterForId + "\n"; - logString += "Intended new document values -- shardKey: " + newShardKey + ", counter: " + - (counterForId + 1); + logString += "Original document values -- id: " + idToUpdate + + ", shardKey: " + currentShardKey + ", counter: " + counterForId + "\n"; + logString += "Intended new document values -- shardKey: " + newShardKey + + ", counter: " + (counterForId + 1); jsTestLog(logString); }; @@ -163,15 +162,15 @@ var $config = extendWorkload($config, function($config, $super) { logString += "Find by old shard key (should be empty): " + tojson(collection.find({skey: currentShardKey}).toArray()) + "\n"; logString += "Find by _id: " + tojson(collection.find({_id: idToUpdate}).toArray()) + "\n"; - logString += "Find by new shard key: " + - tojson(collection.find({skey: newShardKey}).toArray()) + "\n"; + logString += + "Find by new shard key: " + tojson(collection.find({skey: newShardKey}).toArray()) + + "\n"; jsTestLog(logString); }; $config.data.findAndModifyShardKey = function findAndModifyShardKey( db, collName, {wrapInTransaction, moveAcrossChunks} = {}) { - const collection = this.session.getDatabase(db.getName()).getCollection(collName); const shardKeyField = $config.data.shardKeyField; diff --git a/jstests/concurrency/fsm_workloads/remove_and_bulk_insert.js b/jstests/concurrency/fsm_workloads/remove_and_bulk_insert.js index cc2fa5e6562..0401126e907 100644 --- a/jstests/concurrency/fsm_workloads/remove_and_bulk_insert.js +++ b/jstests/concurrency/fsm_workloads/remove_and_bulk_insert.js @@ -10,7 +10,6 @@ * accessed after a WriteConflictException occurred in Collection::deleteDocument(). */ var $config = (function() { - var states = { insert: function insert(db, collName) { var bulk = db[collName].initializeUnorderedBulkOp(); @@ -35,5 +34,4 @@ var $config = (function() { states: states, transitions: transitions }; - })(); diff --git a/jstests/concurrency/fsm_workloads/remove_multiple_documents.js b/jstests/concurrency/fsm_workloads/remove_multiple_documents.js index 5370f999975..c349dc20874 100644 --- a/jstests/concurrency/fsm_workloads/remove_multiple_documents.js +++ b/jstests/concurrency/fsm_workloads/remove_multiple_documents.js @@ -13,7 +13,6 @@ * @tags: [assumes_balancer_off] */ var $config = (function() { - var states = { init: function init(db, collName) { this.numDocs = 200; @@ -42,5 +41,4 @@ var $config = (function() { var transitions = {init: {count: 1}, count: {remove: 1}, remove: {remove: 0.825, count: 0.125}}; return {threadCount: 10, iterations: 20, states: states, transitions: transitions}; - })(); diff --git a/jstests/concurrency/fsm_workloads/remove_single_document.js b/jstests/concurrency/fsm_workloads/remove_single_document.js index 1bfdb2b6897..c2d3831f223 100644 --- a/jstests/concurrency/fsm_workloads/remove_single_document.js +++ b/jstests/concurrency/fsm_workloads/remove_single_document.js @@ -6,7 +6,6 @@ * Repeatedly remove a document from the collection. */ var $config = (function() { - var states = { remove: function remove(db, collName) { // try removing a random document @@ -53,5 +52,4 @@ var $config = (function() { }, startState: 'remove' }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_capped_collection_chain.js b/jstests/concurrency/fsm_workloads/rename_capped_collection_chain.js index 0cd43e0e737..860aa5ea67f 100644 --- a/jstests/concurrency/fsm_workloads/rename_capped_collection_chain.js +++ b/jstests/concurrency/fsm_workloads/rename_capped_collection_chain.js @@ -11,7 +11,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -19,7 +18,6 @@ var $config = (function() { }; var states = (function() { - function uniqueCollectionName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -43,7 +41,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -55,5 +52,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js b/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js index 257b603d1fb..76bdd80f5a3 100644 --- a/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js +++ b/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_chain.js @@ -11,7 +11,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -19,7 +18,6 @@ var $config = (function() { }; var states = (function() { - function uniqueDBName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -56,7 +54,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -68,5 +65,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_droptarget.js b/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_droptarget.js index 10c34653855..72d966bb7a3 100644 --- a/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_droptarget.js +++ b/jstests/concurrency/fsm_workloads/rename_capped_collection_dbname_droptarget.js @@ -11,7 +11,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -19,7 +18,6 @@ var $config = (function() { }; var states = (function() { - var options = {capped: true, size: 4096}; function uniqueDBName(prefix, tid, num) { @@ -79,7 +77,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -91,5 +88,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_capped_collection_droptarget.js b/jstests/concurrency/fsm_workloads/rename_capped_collection_droptarget.js index 1291f130aae..9d2f0b2ac45 100644 --- a/jstests/concurrency/fsm_workloads/rename_capped_collection_droptarget.js +++ b/jstests/concurrency/fsm_workloads/rename_capped_collection_droptarget.js @@ -11,7 +11,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -19,7 +18,6 @@ var $config = (function() { }; var states = (function() { - var options = {capped: true, size: 4096}; function uniqueCollectionName(prefix, tid, num) { @@ -71,7 +69,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -83,5 +80,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js b/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js index e73f7a20959..b933d24e4d0 100644 --- a/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js +++ b/jstests/concurrency/fsm_workloads/rename_collection_dbname_chain.js @@ -9,7 +9,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -17,7 +16,6 @@ var $config = (function() { }; var states = (function() { - function uniqueDBName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -49,7 +47,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -61,5 +58,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_collection_dbname_droptarget.js b/jstests/concurrency/fsm_workloads/rename_collection_dbname_droptarget.js index fdc2bcf8766..e9063730aea 100644 --- a/jstests/concurrency/fsm_workloads/rename_collection_dbname_droptarget.js +++ b/jstests/concurrency/fsm_workloads/rename_collection_dbname_droptarget.js @@ -9,7 +9,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -17,7 +16,6 @@ var $config = (function() { }; var states = (function() { - function uniqueDBName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -72,7 +70,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -84,5 +81,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/rename_collection_droptarget.js b/jstests/concurrency/fsm_workloads/rename_collection_droptarget.js index 550b3e0ae22..91a810015ae 100644 --- a/jstests/concurrency/fsm_workloads/rename_collection_droptarget.js +++ b/jstests/concurrency/fsm_workloads/rename_collection_droptarget.js @@ -9,7 +9,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the collection name, // since the workload name is assumed to be unique. @@ -17,7 +16,6 @@ var $config = (function() { }; var states = (function() { - function uniqueCollectionName(prefix, tid, num) { return prefix + tid + '_' + num; } @@ -64,7 +62,6 @@ var $config = (function() { } return {init: init, rename: rename}; - })(); var transitions = {init: {rename: 1}, rename: {rename: 1}}; @@ -76,5 +73,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/secondary_reads.js b/jstests/concurrency/fsm_workloads/secondary_reads.js index 4970013b56d..f04ec6e75dd 100644 --- a/jstests/concurrency/fsm_workloads/secondary_reads.js +++ b/jstests/concurrency/fsm_workloads/secondary_reads.js @@ -20,7 +20,6 @@ */ var $config = (function() { - // Use the workload name as the collection name. var uniqueCollectionName = 'secondary_reads'; @@ -86,7 +85,6 @@ var $config = (function() { } var states = (function() { - // One thread is dedicated to writing and other threads perform reads on // secondaries with a randomly chosen readConcern level. function readFromSecondaries(db, collName) { diff --git a/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js b/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js index 18218e00978..f98039909f9 100644 --- a/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js +++ b/jstests/concurrency/fsm_workloads/secondary_reads_with_catalog_changes.js @@ -25,7 +25,6 @@ load('jstests/concurrency/fsm_workloads/secondary_reads.js'); // for $config * @tags: [creates_background_indexes, requires_replication, uses_write_concern] */ var $config = extendWorkload($config, function($config, $super) { - $config.states.buildIndex = function buildIndex(db, collName) { if (this.isWriterThread(this.tid)) { this.insertDocuments(db, this.collName); diff --git a/jstests/concurrency/fsm_workloads/server_status.js b/jstests/concurrency/fsm_workloads/server_status.js index fa3c8cbbeef..0c95bfe0ff3 100644 --- a/jstests/concurrency/fsm_workloads/server_status.js +++ b/jstests/concurrency/fsm_workloads/server_status.js @@ -6,7 +6,6 @@ * Simply checks that the serverStatus command works */ var $config = (function() { - var states = { status: function status(db, collName) { var opts = diff --git a/jstests/concurrency/fsm_workloads/sharded_base_partitioned.js b/jstests/concurrency/fsm_workloads/sharded_base_partitioned.js index 018951ea053..7d16f61dd8d 100644 --- a/jstests/concurrency/fsm_workloads/sharded_base_partitioned.js +++ b/jstests/concurrency/fsm_workloads/sharded_base_partitioned.js @@ -24,7 +24,6 @@ load('jstests/concurrency/fsm_workload_helpers/chunks.js'); // for chunk helpers var $config = (function() { - var data = { partitionSize: 1, // We use a non-hashed shard key of { _id: 1 } so that documents reside on their expected @@ -82,8 +81,8 @@ var $config = (function() { return coll .aggregate([ { - $match: - {ns: this.partition.ns, [maxField]: {$lte: this.partition.chunkUpper}} + $match: + {ns: this.partition.ns, [maxField]: {$lte: this.partition.chunkUpper}} }, {$sample: {size: 1}} ]) @@ -92,8 +91,8 @@ var $config = (function() { return coll .aggregate([ { - $match: - {ns: this.partition.ns, [minField]: {$gte: this.partition.chunkLower}} + $match: + {ns: this.partition.ns, [minField]: {$gte: this.partition.chunkLower}} }, {$sample: {size: 1}} ]) @@ -102,11 +101,11 @@ var $config = (function() { return coll .aggregate([ { - $match: { - ns: this.partition.ns, - [minField]: {$gte: this.partition.chunkLower}, - [maxField]: {$lte: this.partition.chunkUpper} - } + $match: { + ns: this.partition.ns, + [minField]: {$gte: this.partition.chunkLower}, + [maxField]: {$lte: this.partition.chunkUpper} + } }, {$sample: {size: 1}} ]) @@ -115,8 +114,8 @@ var $config = (function() { }; // This is used by the extended workloads to perform additional setup for more splitPoints. - data.setupAdditionalSplitPoints = function setupAdditionalSplitPoints(db, collName, partition) { - }; + data.setupAdditionalSplitPoints = function setupAdditionalSplitPoints( + db, collName, partition) {}; var states = (function() { // Inform this thread about its partition, @@ -185,7 +184,6 @@ var $config = (function() { this.setupAdditionalSplitPoints(db, collName, partition); } - }; return { diff --git a/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js b/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js index 9ac083818b7..6e05411f345 100644 --- a/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js +++ b/jstests/concurrency/fsm_workloads/sharded_mergeChunks_partitioned.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for e load('jstests/concurrency/fsm_workloads/sharded_base_partitioned.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.iterations = 8; $config.threadCount = 5; @@ -250,7 +249,6 @@ var $config = extendWorkload($config, function($config, $super) { assertWhenOwnColl.eq(numChunksAfter, numChunksBefore, msg); } } - }; $config.transitions = {init: {mergeChunks: 1}, mergeChunks: {mergeChunks: 1}}; diff --git a/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js b/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js index fd03bf37e48..70515b7eaa9 100644 --- a/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js +++ b/jstests/concurrency/fsm_workloads/sharded_moveChunk_drop_shard_key_index.js @@ -11,7 +11,6 @@ */ var $config = (function() { - var data = {numSplitPoints: 100, shardKey: {key: 1}}; var states = { @@ -79,5 +78,4 @@ var $config = (function() { transitions: transitions, setup: setup, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/sharded_moveChunk_partitioned.js b/jstests/concurrency/fsm_workloads/sharded_moveChunk_partitioned.js index cf2eb18ead9..f3c26e8d057 100644 --- a/jstests/concurrency/fsm_workloads/sharded_moveChunk_partitioned.js +++ b/jstests/concurrency/fsm_workloads/sharded_moveChunk_partitioned.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for e load('jstests/concurrency/fsm_workloads/sharded_base_partitioned.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.iterations = 5; $config.threadCount = 5; @@ -112,8 +111,8 @@ var $config = extendWorkload($config, function($config, $super) { // shard with the toShard. If the operation failed, verify that the config kept // the chunk's shard as the fromShard. var chunkAfter = conn.getDB('config').chunks.findOne({_id: chunk._id}); - var msg = msgBase + '\nchunkBefore: ' + tojson(chunk) + '\nchunkAfter: ' + - tojson(chunkAfter); + var msg = msgBase + '\nchunkBefore: ' + tojson(chunk) + + '\nchunkAfter: ' + tojson(chunkAfter); if (moveChunkRes.ok) { msg = "moveChunk succeeded but chunk's shard was not new shard.\n" + msg; assertWhenOwnColl.eq(chunkAfter.shard, toShard, msg); diff --git a/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js b/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js index 8a32ea24f97..97d6f6df6e8 100644 --- a/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js +++ b/jstests/concurrency/fsm_workloads/sharded_splitChunk_partitioned.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for e load('jstests/concurrency/fsm_workloads/sharded_base_partitioned.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.iterations = 5; $config.threadCount = 5; @@ -23,7 +22,6 @@ var $config = extendWorkload($config, function($config, $super) { // in the cluster affected by the splitChunk operation sees the appropriate // after-state regardless of whether the operation succeeded or failed. $config.states.splitChunk = function splitChunk(db, collName, connCache) { - var dbName = db.getName(); var ns = db[collName].getFullName(); var config = ChunkHelper.getPrimary(connCache.config); diff --git a/jstests/concurrency/fsm_workloads/snapshot_read_catalog_operations.js b/jstests/concurrency/fsm_workloads/snapshot_read_catalog_operations.js index e6042ab0e1d..008b0fe05f0 100644 --- a/jstests/concurrency/fsm_workloads/snapshot_read_catalog_operations.js +++ b/jstests/concurrency/fsm_workloads/snapshot_read_catalog_operations.js @@ -160,5 +160,4 @@ var $config = (function() { setup: setup, data: data, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js b/jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js index 7211970d2a5..f5c3a2670f8 100644 --- a/jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js +++ b/jstests/concurrency/fsm_workloads/snapshot_read_kill_op_only.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // load('jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.transitions = { init: {snapshotFind: 1.0}, snapshotFind: {incrementTxnNumber: 0.33, killOp: 0.34, snapshotGetMore: 0.33}, diff --git a/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js b/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js index 47f1bf836dd..70db1a7c44b 100644 --- a/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js +++ b/jstests/concurrency/fsm_workloads/snapshot_read_kill_operations.js @@ -38,18 +38,18 @@ var $config = (function() { doSnapshotGetMore(collName, this, [ - ErrorCodes.CursorKilled, - ErrorCodes.CursorNotFound, - ErrorCodes.Interrupted, - ErrorCodes.LockTimeout, - ErrorCodes.NoSuchTransaction, + ErrorCodes.CursorKilled, + ErrorCodes.CursorNotFound, + ErrorCodes.Interrupted, + ErrorCodes.LockTimeout, + ErrorCodes.NoSuchTransaction, ], [ - ErrorCodes.NoSuchTransaction, - ErrorCodes.Interrupted, - // Anonymous code for when user tries to send commit as the first - // operation in a transaction without sending a recovery token - 50940 + ErrorCodes.NoSuchTransaction, + ErrorCodes.Interrupted, + // Anonymous code for when user tries to send commit as the first + // operation in a transaction without sending a recovery token + 50940 ]); }, @@ -151,5 +151,4 @@ var $config = (function() { teardown: teardown, data: data, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_and_bulk_insert.js b/jstests/concurrency/fsm_workloads/update_and_bulk_insert.js index 16b20e91a23..ed27a6bbc63 100644 --- a/jstests/concurrency/fsm_workloads/update_and_bulk_insert.js +++ b/jstests/concurrency/fsm_workloads/update_and_bulk_insert.js @@ -11,7 +11,6 @@ * Collection::updateDocument(). */ var $config = (function() { - var states = { insert: function insert(db, collName) { var bulk = db[collName].initializeUnorderedBulkOp(); @@ -40,5 +39,4 @@ var $config = (function() { states: states, transitions: transitions }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_array.js b/jstests/concurrency/fsm_workloads/update_array.js index 2020ee3c60a..d4923b485bb 100644 --- a/jstests/concurrency/fsm_workloads/update_array.js +++ b/jstests/concurrency/fsm_workloads/update_array.js @@ -14,9 +14,7 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - var states = (function() { - // db: explicitly passed to avoid accidentally using the global `db` // res: WriteResult // nModifiedPossibilities: array of allowed values for res.nModified @@ -107,7 +105,6 @@ var $config = (function() { doPull(db, collName, docIndex, value); } }; - })(); var transitions = {push: {push: 0.8, pull: 0.2}, pull: {push: 0.8, pull: 0.2}}; @@ -131,5 +128,4 @@ var $config = (function() { data: {numDocs: 10}, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_check_index.js b/jstests/concurrency/fsm_workloads/update_check_index.js index bd82e39c471..8a94c568d6f 100644 --- a/jstests/concurrency/fsm_workloads/update_check_index.js +++ b/jstests/concurrency/fsm_workloads/update_check_index.js @@ -7,7 +7,6 @@ * for SERVER-17132. */ var $config = (function() { - var states = (function() { function multiUpdate(db, collName) { // Set 'c' to some random value. diff --git a/jstests/concurrency/fsm_workloads/update_inc.js b/jstests/concurrency/fsm_workloads/update_inc.js index 15675bc3f02..5eedadeedbf 100644 --- a/jstests/concurrency/fsm_workloads/update_inc.js +++ b/jstests/concurrency/fsm_workloads/update_inc.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - var data = { // uses the workload name as _id on the document. // assumes this name will be unique. @@ -96,5 +95,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_multifield.js b/jstests/concurrency/fsm_workloads/update_multifield.js index 1e3087be413..da980099b70 100644 --- a/jstests/concurrency/fsm_workloads/update_multifield.js +++ b/jstests/concurrency/fsm_workloads/update_multifield.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - function makeQuery(options) { var query = {}; if (!options.multi) { @@ -103,5 +102,4 @@ var $config = (function() { }, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_multifield_multiupdate.js b/jstests/concurrency/fsm_workloads/update_multifield_multiupdate.js index 7654b8bac19..346a883c484 100644 --- a/jstests/concurrency/fsm_workloads/update_multifield_multiupdate.js +++ b/jstests/concurrency/fsm_workloads/update_multifield_multiupdate.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_workloads/update_multifield.js'); // for $config load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = extendWorkload($config, function($config, $super) { - $config.data.multi = true; $config.data.assertResult = function(res, db, collName, query) { diff --git a/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js b/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js index f339a8e004e..06c2c2907ba 100644 --- a/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js +++ b/jstests/concurrency/fsm_workloads/update_ordered_bulk_inc.js @@ -15,7 +15,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - var states = { init: function init(db, collName) { this.fieldName = 't' + this.tid; @@ -82,5 +81,4 @@ var $config = (function() { setup: setup, data: {docCount: 15} }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_rename.js b/jstests/concurrency/fsm_workloads/update_rename.js index ca74ac5287d..675c469848e 100644 --- a/jstests/concurrency/fsm_workloads/update_rename.js +++ b/jstests/concurrency/fsm_workloads/update_rename.js @@ -6,7 +6,6 @@ * Each thread does a $rename to cause documents to jump between indexes. */ var $config = (function() { - var fieldNames = ['update_rename_x', 'update_rename_y', 'update_rename_z']; function choose(array) { @@ -69,5 +68,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_replace.js b/jstests/concurrency/fsm_workloads/update_replace.js index 2d04f38294c..12b6c8026f4 100644 --- a/jstests/concurrency/fsm_workloads/update_replace.js +++ b/jstests/concurrency/fsm_workloads/update_replace.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - // explicitly pass db to avoid accidentally using the global `db` function assertResult(db, res) { assertAlways.eq(0, res.nUpserted, tojson(res)); @@ -88,5 +87,4 @@ var $config = (function() { transitions: transitions, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_simple.js b/jstests/concurrency/fsm_workloads/update_simple.js index cb4adf926c9..65178eafafb 100644 --- a/jstests/concurrency/fsm_workloads/update_simple.js +++ b/jstests/concurrency/fsm_workloads/update_simple.js @@ -13,7 +13,6 @@ load('jstests/concurrency/fsm_workload_helpers/server_types.js'); var $config = (function() { - var states = { set: function set(db, collName) { this.setOrUnset(db, collName, true, this.numDocs); @@ -93,5 +92,4 @@ var $config = (function() { }, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_upsert_multi.js b/jstests/concurrency/fsm_workloads/update_upsert_multi.js index 3b32f166d3f..bffcbc232fa 100644 --- a/jstests/concurrency/fsm_workloads/update_upsert_multi.js +++ b/jstests/concurrency/fsm_workloads/update_upsert_multi.js @@ -12,7 +12,6 @@ * @tags: [requires_non_retryable_writes] */ var $config = (function() { - var states = { insert: function insert(db, collName) { var query, update, options; @@ -80,5 +79,4 @@ var $config = (function() { data: {counter: 0, shardKey: {tid: 1}}, setup: setup }; - })(); diff --git a/jstests/concurrency/fsm_workloads/update_where.js b/jstests/concurrency/fsm_workloads/update_where.js index 614cbc86093..b9723c86c07 100644 --- a/jstests/concurrency/fsm_workloads/update_where.js +++ b/jstests/concurrency/fsm_workloads/update_where.js @@ -20,8 +20,8 @@ var $config = extendWorkload($config, function($config, $super) { var res = db[collName].update( // Server-side JS does not support Random.randInt, so use Math.floor/random instead { - $where: 'this.x === Math.floor(Math.random() * ' + this.randomBound + ') ' + - '&& this.tid === ' + this.tid + $where: 'this.x === Math.floor(Math.random() * ' + this.randomBound + ') ' + + '&& this.tid === ' + this.tid }, {$set: {x: Random.randInt(this.randomBound)}}, {multi: true}); diff --git a/jstests/concurrency/fsm_workloads/upsert_unique_index.js b/jstests/concurrency/fsm_workloads/upsert_unique_index.js index 62d91794ccb..15a7d1b14fc 100644 --- a/jstests/concurrency/fsm_workloads/upsert_unique_index.js +++ b/jstests/concurrency/fsm_workloads/upsert_unique_index.js @@ -6,7 +6,6 @@ * upsert generates an insert, which then fails due to another operation inserting first. */ var $config = (function() { - const data = { numDocs: 4, getDocValue: function() { diff --git a/jstests/concurrency/fsm_workloads/upsert_where.js b/jstests/concurrency/fsm_workloads/upsert_where.js index 7fa00727725..522fef6b32f 100644 --- a/jstests/concurrency/fsm_workloads/upsert_where.js +++ b/jstests/concurrency/fsm_workloads/upsert_where.js @@ -4,7 +4,8 @@ * upsert_where.js * * Bulk inserts documents in batches of 100, randomly selects a document that doesn't exist and - * updates it, and queries by the thread that created the documents to verify counts. */ + * updates it, and queries by the thread that created the documents to verify counts. + */ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/indexed_insert_where.js'); // for $config diff --git a/jstests/concurrency/fsm_workloads/view_catalog.js b/jstests/concurrency/fsm_workloads/view_catalog.js index ebcd37a9c05..9557a9f9387 100644 --- a/jstests/concurrency/fsm_workloads/view_catalog.js +++ b/jstests/concurrency/fsm_workloads/view_catalog.js @@ -8,7 +8,6 @@ */ var $config = (function() { - var data = { // Use the workload name as a prefix for the view name, since the workload name is assumed // to be unique. @@ -17,7 +16,6 @@ var $config = (function() { }; var states = (function() { - function init(db, collName) { this.threadCollName = db[collName].getName(); this.threadViewName = this.prefix + '_' + this.tid; @@ -65,7 +63,6 @@ var $config = (function() { } return {init: init, create: create, modify: modify, drop: drop}; - })(); var transitions = { @@ -100,5 +97,4 @@ var $config = (function() { states: states, transitions: transitions, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/view_catalog_cycle_lookup.js b/jstests/concurrency/fsm_workloads/view_catalog_cycle_lookup.js index 4745ef3d427..98ccaa7e3d0 100644 --- a/jstests/concurrency/fsm_workloads/view_catalog_cycle_lookup.js +++ b/jstests/concurrency/fsm_workloads/view_catalog_cycle_lookup.js @@ -9,7 +9,6 @@ */ var $config = (function() { - // Use the workload name as a prefix for the view names, since the workload name is assumed // to be unique. const prefix = 'view_catalog_cycle_lookup_'; @@ -19,13 +18,14 @@ var $config = (function() { getRandomView: function(viewList) { return viewList[Random.randInt(viewList.length)]; }, - getRandomViewPipeline: function() { - const lookupViewNs1 = this.getRandomView(this.viewList); - const lookupViewNs2 = this.getRandomView(this.viewList); - const index = Random.randInt(4); - switch (index) { - case 0: - return [{ + getRandomViewPipeline: + function() { + const lookupViewNs1 = this.getRandomView(this.viewList); + const lookupViewNs2 = this.getRandomView(this.viewList); + const index = Random.randInt(4); + switch (index) { + case 0: + return [{ $lookup: { from: lookupViewNs1, localField: 'a', @@ -33,8 +33,8 @@ var $config = (function() { as: 'result1' } }]; - case 1: - return [{ + case 1: + return [{ $lookup: { from: lookupViewNs1, let : {a1: '$a'}, @@ -52,8 +52,8 @@ var $config = (function() { as: 'result2' } }]; - case 2: - return [{ + case 2: + return [{ $graphLookup: { from: lookupViewNs1, startWith: '$a', @@ -62,12 +62,12 @@ var $config = (function() { as: 'result3' } }]; - case 3: - return []; - default: - assertAlways(false, "Invalid index: " + index); - } - }, + case 3: + return []; + default: + assertAlways(false, "Invalid index: " + index); + } + }, }; var states = (function() { @@ -114,7 +114,6 @@ var $config = (function() { remapViewToCollection: remapViewToCollection, readFromView: readFromView, }; - })(); var transitions = { diff --git a/jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js b/jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js index d7eb28009cf..51eee139928 100644 --- a/jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js +++ b/jstests/concurrency/fsm_workloads/view_catalog_cycle_with_drop.js @@ -8,7 +8,6 @@ */ var $config = (function() { - // Use the workload name as a prefix for the view names, since the workload name is assumed // to be unique. const prefix = 'view_catalog_cycle_with_drop_'; @@ -76,7 +75,6 @@ var $config = (function() { recreateViewOnCollection: recreateViewOnCollection, readFromView: readFromView }; - })(); var transitions = { @@ -114,5 +112,4 @@ var $config = (function() { transitions: transitions, setup: setup, }; - })(); diff --git a/jstests/concurrency/fsm_workloads/yield.js b/jstests/concurrency/fsm_workloads/yield.js index 5aaf9f086e7..748c912352c 100644 --- a/jstests/concurrency/fsm_workloads/yield.js +++ b/jstests/concurrency/fsm_workloads/yield.js @@ -7,7 +7,6 @@ * removing documents that they operate on. */ var $config = (function() { - // The explain used to build the assertion message in advanceCursor() is the only command not // allowed in a transaction used in the query state function. With shard stepdowns, getMores // aren't allowed outside a transaction, so if the explain runs when the suite is configured to @@ -36,13 +35,14 @@ var $config = (function() { while (cursor.hasNext()) { prevDoc = doc; doc = cursor.next(); - assertAlways(verifier(doc, prevDoc), - 'Verifier failed!\nQuery: ' + tojson(cursor._query) + '\n' + - (skipExplainInErrorMessage ? '' : 'Query plan: ' + - tojson(cursor.explain())) + - '\n' + - 'Previous doc: ' + tojson(prevDoc) + '\n' + - 'This doc: ' + tojson(doc)); + assertAlways( + verifier(doc, prevDoc), + 'Verifier failed!\nQuery: ' + tojson(cursor._query) + '\n' + + (skipExplainInErrorMessage ? '' + : 'Query plan: ' + tojson(cursor.explain())) + + '\n' + + 'Previous doc: ' + tojson(prevDoc) + '\n' + + 'This doc: ' + tojson(doc)); } assertAlways.eq(cursor.itcount(), 0); }, @@ -169,5 +169,4 @@ var $config = (function() { teardown: teardown, data: data }; - })(); diff --git a/jstests/concurrency/fsm_workloads/yield_and_hashed.js b/jstests/concurrency/fsm_workloads/yield_and_hashed.js index 60d73670a1f..21d43a6d536 100644 --- a/jstests/concurrency/fsm_workloads/yield_and_hashed.js +++ b/jstests/concurrency/fsm_workloads/yield_and_hashed.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWork load('jstests/concurrency/fsm_workloads/yield_rooted_or.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Issue a query that will use the AND_HASH stage. This is a little tricky, so use * stagedebug to force it to happen. Unfortunately this means it can't be batched. diff --git a/jstests/concurrency/fsm_workloads/yield_and_sorted.js b/jstests/concurrency/fsm_workloads/yield_and_sorted.js index ea077aeed12..480b9258d78 100644 --- a/jstests/concurrency/fsm_workloads/yield_and_sorted.js +++ b/jstests/concurrency/fsm_workloads/yield_and_sorted.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWork load('jstests/concurrency/fsm_workloads/yield_rooted_or.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Issue a query that will use the AND_SORTED stage. This is a little tricky, so use * stagedebug to force it to happen. Unfortunately this means it can't be batched. diff --git a/jstests/concurrency/fsm_workloads/yield_fetch.js b/jstests/concurrency/fsm_workloads/yield_fetch.js index e802635af73..7b5a0007042 100644 --- a/jstests/concurrency/fsm_workloads/yield_fetch.js +++ b/jstests/concurrency/fsm_workloads/yield_fetch.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWork load('jstests/concurrency/fsm_workloads/yield_rooted_or.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Issue a query that will use the FETCH stage. */ diff --git a/jstests/concurrency/fsm_workloads/yield_geo_near_dedup.js b/jstests/concurrency/fsm_workloads/yield_geo_near_dedup.js index 7fb5c860a7a..1e6da602641 100644 --- a/jstests/concurrency/fsm_workloads/yield_geo_near_dedup.js +++ b/jstests/concurrency/fsm_workloads/yield_geo_near_dedup.js @@ -8,7 +8,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkl load('jstests/concurrency/fsm_workloads/yield_geo_near.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - $config.states.remove = function remove(db, collName) { var id = Random.randInt(this.nDocs); var doc = db[collName].findOne({_id: id}); diff --git a/jstests/concurrency/fsm_workloads/yield_id_hack.js b/jstests/concurrency/fsm_workloads/yield_id_hack.js index eddb653c1d8..a0ba2ffcf16 100644 --- a/jstests/concurrency/fsm_workloads/yield_id_hack.js +++ b/jstests/concurrency/fsm_workloads/yield_id_hack.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/yield.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Issue a query that will use the ID_HACK stage. This cannot be * batched, so issue a diff --git a/jstests/concurrency/fsm_workloads/yield_rooted_or.js b/jstests/concurrency/fsm_workloads/yield_rooted_or.js index 2d21427b42b..b21e918e5bc 100644 --- a/jstests/concurrency/fsm_workloads/yield_rooted_or.js +++ b/jstests/concurrency/fsm_workloads/yield_rooted_or.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/yield.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Issue a query with an or stage as the root. */ diff --git a/jstests/concurrency/fsm_workloads/yield_sort.js b/jstests/concurrency/fsm_workloads/yield_sort.js index 1c535ae6415..af8fef20510 100644 --- a/jstests/concurrency/fsm_workloads/yield_sort.js +++ b/jstests/concurrency/fsm_workloads/yield_sort.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWor load('jstests/concurrency/fsm_workloads/yield_sort_merge.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Execute a query that will use the SORT stage. */ diff --git a/jstests/concurrency/fsm_workloads/yield_sort_merge.js b/jstests/concurrency/fsm_workloads/yield_sort_merge.js index d715a813701..b66f185854d 100644 --- a/jstests/concurrency/fsm_workloads/yield_sort_merge.js +++ b/jstests/concurrency/fsm_workloads/yield_sort_merge.js @@ -11,7 +11,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/yield.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Execute a query that will use the SORT_MERGE stage. */ diff --git a/jstests/concurrency/fsm_workloads/yield_text.js b/jstests/concurrency/fsm_workloads/yield_text.js index 0ccf5b8a7d4..2b14a051b73 100644 --- a/jstests/concurrency/fsm_workloads/yield_text.js +++ b/jstests/concurrency/fsm_workloads/yield_text.js @@ -10,7 +10,6 @@ load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload load('jstests/concurrency/fsm_workloads/yield.js'); // for $config var $config = extendWorkload($config, function($config, $super) { - /* * Pick a random word and search for it using full text search. */ |