summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Boros <ian.boros@10gen.com>2018-03-01 18:44:28 -0500
committerIan Boros <ian.boros@10gen.com>2018-03-02 10:26:14 -0500
commitdaf6cd9398541c09c8fe6a74a932f61623d164ff (patch)
treecb71bc405c4b8aaff84b9e4934c802cb18613d23
parenta53005feed80e81610183b542b5aaa44b85dd3a9 (diff)
downloadmongo-daf6cd9398541c09c8fe6a74a932f61623d164ff.tar.gz
SERVER-33603 invalidated_cursors.js now runs getMores against the right collection
-rw-r--r--jstests/concurrency/fsm_workloads/invalidated_cursors.js40
1 files changed, 20 insertions, 20 deletions
diff --git a/jstests/concurrency/fsm_workloads/invalidated_cursors.js b/jstests/concurrency/fsm_workloads/invalidated_cursors.js
index d8c9b3308d4..8d7979a47c1 100644
--- a/jstests/concurrency/fsm_workloads/invalidated_cursors.js
+++ b/jstests/concurrency/fsm_workloads/invalidated_cursors.js
@@ -56,8 +56,8 @@ var $config = (function() {
* Runs a query on the collection with a small enough batchSize to leave the cursor open.
* If the command was successful, stores the resulting cursor in 'this.cursor'.
*/
- query: function query(db, collName) {
- let myDB = db.getSiblingDB(this.uniqueDBName);
+ query: function query(unusedDB, unusedCollName) {
+ let myDB = unusedDB.getSiblingDB(this.uniqueDBName);
let res = myDB.runCommand({
find: this.chooseRandomlyFrom(this.involvedCollections),
filter: {},
@@ -65,15 +65,15 @@ var $config = (function() {
});
if (res.ok) {
- this.cursor = new DBCommandCursor(db, res, this.batchSize);
+ this.cursor = new DBCommandCursor(myDB, res, this.batchSize);
}
},
/**
* Explains a find on a collection.
*/
- explain: function explain(db, collName) {
- let myDB = db.getSiblingDB(this.uniqueDBName);
+ explain: function explain(unusedDB, unusedCollName) {
+ let myDB = unusedDB.getSiblingDB(this.uniqueDBName);
let res = myDB.runCommand({
explain: {find: this.chooseRandomlyFrom(this.involvedCollections), filter: {}},
verbosity: "executionStats"
@@ -81,7 +81,7 @@ var $config = (function() {
assertAlways.commandWorked(res);
},
- killCursor: function killCursor(db, collName) {
+ killCursor: function killCursor(unusedDB, unusedCollName) {
if (this.hasOwnProperty('cursor')) {
this.cursor.close();
}
@@ -91,7 +91,7 @@ var $config = (function() {
* Requests enough results from 'this.cursor' to ensure that another batch is needed, and
* thus ensures that a getMore request is sent for 'this.cursor'.
*/
- getMore: function getMore(db, collName) {
+ getMore: function getMore(unusedDB, unusedCollName) {
if (!this.hasOwnProperty('cursor')) {
return;
}
@@ -120,15 +120,15 @@ var $config = (function() {
* Drops the database being used by this workload and then re-creates each of
* 'this.involvedCollections' by repopulating them with data and indexes.
*/
- dropDatabase: function dropDatabase(db, collName) {
- if (isMongos(db)) {
+ dropDatabase: function dropDatabase(unusedDB, unusedCollName) {
+ if (isMongos(unusedDB)) {
// SERVER-17397: Drops in a sharded cluster may not fully succeed. It is not safe
// to drop and then recreate a collection with the same name, so we skip dropping
// and recreating the database.
return;
}
- let myDB = db.getSiblingDB(this.uniqueDBName);
+ let myDB = unusedDB.getSiblingDB(this.uniqueDBName);
myDB.dropDatabase();
// Re-create all of the collections and indexes that were dropped.
@@ -141,14 +141,14 @@ var $config = (function() {
* Randomly selects a collection from 'this.involvedCollections' and drops it. The
* collection is then re-created with data and indexes.
*/
- dropCollection: function dropCollection(db, collName) {
- if (isMongos(db)) {
+ dropCollection: function dropCollection(unusedDB, unusedCollName) {
+ if (isMongos(unusedDB)) {
// SERVER-17397: Drops in a sharded cluster may not fully succeed. It is not safe
// to drop and then recreate a collection with the same name, so we skip it.
return;
}
- let myDB = db.getSiblingDB(this.uniqueDBName);
+ let myDB = unusedDB.getSiblingDB(this.uniqueDBName);
let targetColl = this.chooseRandomlyFrom(this.involvedCollections);
myDB[targetColl].drop();
@@ -162,8 +162,8 @@ var $config = (function() {
* 'this.indexSpecs' and drops that particular index from the collection. The index is then
* re-created.
*/
- dropIndex: function dropIndex(db, collName) {
- let myDB = db.getSiblingDB(this.uniqueDBName);
+ dropIndex: function dropIndex(unusedDB, unusedCollName) {
+ let myDB = unusedDB.getSiblingDB(this.uniqueDBName);
let targetColl = this.chooseRandomlyFrom(this.involvedCollections);
let indexSpec = this.chooseRandomlyFrom(this.indexSpecs);
@@ -194,20 +194,20 @@ var $config = (function() {
dropIndex: {init: 1}
};
- function setup(db, collName, cluster) {
+ function setup(unusedDB, unusedCollName, cluster) {
// Use the workload name as part of the database name, since the workload name is assumed to
// be unique.
- this.uniqueDBName = db.getName() + 'invalidated_cursors';
+ this.uniqueDBName = unusedDB.getName() + 'invalidated_cursors';
- let myDB = db.getSiblingDB(this.uniqueDBName);
+ let myDB = unusedDB.getSiblingDB(this.uniqueDBName);
this.involvedCollections.forEach(collName => {
this.populateDataAndIndexes(myDB, collName);
assertAlways.eq(this.numDocs, myDB[collName].find({}).itcount());
});
}
- function teardown(db, collName, cluster) {
- db.getSiblingDB(this.uniqueDBName).dropDatabase();
+ function teardown(unusedDB, unusedCollName, cluster) {
+ unusedDB.getSiblingDB(this.uniqueDBName).dropDatabase();
}
return {