summaryrefslogtreecommitdiff
path: root/jstests
diff options
context:
space:
mode:
authorTess Avitabile <tess.avitabile@mongodb.com>2016-06-27 17:36:03 -0400
committerTess Avitabile <tess.avitabile@mongodb.com>2016-07-14 10:09:54 -0400
commit57862d65fa0240690fc2455a4c7cb12b7cff1583 (patch)
tree8a18898fca95d922a1788dc0deb74662de872c40 /jstests
parentfe4c678a39e385e343c6f06a72c92252a132cabb (diff)
downloadmongo-57862d65fa0240690fc2455a4c7cb12b7cff1583.tar.gz
SERVER-24511 Make frequency with which background job that kills timed-out cursors is run configurable
Diffstat (limited to 'jstests')
-rw-r--r--jstests/sharding/cursor_timeout.js27
1 files changed, 22 insertions, 5 deletions
diff --git a/jstests/sharding/cursor_timeout.js b/jstests/sharding/cursor_timeout.js
index cea17d93dcc..90097261eb9 100644
--- a/jstests/sharding/cursor_timeout.js
+++ b/jstests/sharding/cursor_timeout.js
@@ -15,8 +15,14 @@
shards: 2,
other: {
chunkSize: 1,
- shardOptions: {setParameter: "cursorTimeoutMillis=1000"},
- mongosOptions: {setParameter: "cursorTimeoutMillis=1000"}
+ shardOptions: {
+ verbose: 1,
+ setParameter: {cursorTimeoutMillis: 1000, clientCursorMonitorFrequencySecs: 1}
+ },
+ mongosOptions: {
+ verbose: 1,
+ setParameter: {cursorTimeoutMillis: 1000, clientCursorMonitorFrequencySecs: 1}
+ }
}
});
@@ -66,9 +72,20 @@
cursorWithNoTimeout.next();
// Wait until the idle cursor background job has killed the cursors that do not have the "no
- // timeout" flag set. We use the "cursorTimeoutMillis" setParameter above to reduce the amount
- // of time we need to wait here.
- sleep(5000);
+ // timeout" flag set. We use the "cursorTimeoutMillis" and "clientCursorMonitorFrequencySecs"
+ // setParameters above to reduce the amount of time we need to wait here.
+ assert.soon(function() {
+ return coll.getDB().serverStatus().metrics.cursor.timedOut > 0;
+ }, "sharded cursor failed to time out", 5000);
+
+ // Wait for the shard to have two open cursors on it (shardedCursorWithNoTimeout and
+ // cursorWithNoTimeout).
+ // We cannot reliably use metrics.cursor.timedOut here, because this will be 2 if
+ // shardedCursorWithTimeout is killed for timing out on the shard, and 1 if
+ // shardedCursorWithTimeout is killed by a killCursors command from the mongos.
+ assert.soon(function() {
+ return shardColl.getDB().serverStatus().metrics.cursor.open.total == 2;
+ }, "cursor failed to time out", 5000);
assert.throws(function() {
shardedCursorWithTimeout.itcount();