diff options
author | Geert Bosch <geert@mongodb.com> | 2016-11-22 16:53:05 -0500 |
---|---|---|
committer | Geert Bosch <geert@mongodb.com> | 2016-11-28 17:30:28 -0500 |
commit | 647ebfac9ebf1c5fc431a2ba813bf9c97b9bdab9 (patch) | |
tree | 93d4898671ee2b75f900013486a54dd875edab05 /jstests | |
parent | 3c5671874c56a4b7866fda9bec9c233d3f754313 (diff) | |
download | mongo-647ebfac9ebf1c5fc431a2ba813bf9c97b9bdab9.tar.gz |
SERVER-24963 Fix invalidation of cursors on system.indexes
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/core/list_indexes_invalidation.js | 22 | ||||
-rw-r--r-- | jstests/readonly/lib/read_only_test.js | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/jstests/core/list_indexes_invalidation.js b/jstests/core/list_indexes_invalidation.js new file mode 100644 index 00000000000..0557cb0e17b --- /dev/null +++ b/jstests/core/list_indexes_invalidation.js @@ -0,0 +1,22 @@ +// SERVER-24963 Missing invalidation for system.indexes write +(function() { + 'use strict'; + let collName = 'system_indexes_invalidations'; + let coll = db[collName]; + coll.drop(); + assert.commandWorked(coll.createIndexes([{a: 1}, {b: 1}, {c: 1}])); + + // Get the first two indexes. Use find on 'system.indexes' on MMAPv1, listIndexes otherwise. + let cmd = db.system.indexes.count() ? {find: 'system.indexes'} : {listIndexes: collName}; + Object.extend(cmd, {batchSize: 2}); + let res = db.runCommand(cmd); + assert.commandWorked(res, 'could not run ' + tojson(cmd)); + printjson(res); + + // Ensure the cursor has data, drop the collection, and exhaust the cursor. + let cursor = new DBCommandCursor(db.getMongo(), res); + let errMsg = 'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res); + assert(cursor.hasNext(), errMsg); + assert(coll.drop()); + assert.gt(cursor.itcount(), 0, errMsg); +}()); diff --git a/jstests/readonly/lib/read_only_test.js b/jstests/readonly/lib/read_only_test.js index 99d0a1ced92..5b2775e697a 100644 --- a/jstests/readonly/lib/read_only_test.js +++ b/jstests/readonly/lib/read_only_test.js @@ -1,7 +1,7 @@ var StandaloneFixture, ShardedFixture, runReadOnlyTest, zip2, cycleN; (function() { - "use_strict"; + "use strict"; function makeDirectoryReadOnly(dir) { if (_isWindows()) { |