diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-07-25 10:21:02 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-07-25 10:21:02 -0400 |
commit | 82cd8943dab085447ee180d4d59c2c5da778c523 (patch) | |
tree | a744233be38d20ee81a2c106950c9a6888031c6e /jstests/concurrency | |
parent | d19f36ab7c2df36f2d412bf8a5b7c6dbfe9f6d9d (diff) | |
download | mongo-82cd8943dab085447ee180d4d59c2c5da778c523.tar.gz |
SERVER-25039 Abort aggregation planning when a catalog operation occurs.
This prevents the aggregation system from trying to continue query
planning when the collection longer exists.
Diffstat (limited to 'jstests/concurrency')
-rw-r--r-- | jstests/concurrency/fsm_workloads/kill_aggregation.js | 45 | ||||
-rw-r--r-- | jstests/concurrency/fsm_workloads/kill_rooted_or.js | 3 |
2 files changed, 47 insertions, 1 deletions
diff --git a/jstests/concurrency/fsm_workloads/kill_aggregation.js b/jstests/concurrency/fsm_workloads/kill_aggregation.js new file mode 100644 index 00000000000..517e1c49e4a --- /dev/null +++ b/jstests/concurrency/fsm_workloads/kill_aggregation.js @@ -0,0 +1,45 @@ +'use strict'; + +/** + * kill_aggregation.js + * + * Tests that the aggregation system correctly halts its planning to determine whether the query + * system can provide a non-blocking sort or can provide a covered projection when a catalog + * operation occurs. + * + * This workload was designed to reproduce SERVER-25039. + */ + +load('jstests/concurrency/fsm_libs/extend_workload.js'); // for extendWorkload +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. + $config.data.collName = 'kill_aggregation'; + + $config.states.query = function query(db, collName) { + var res = db.runCommand({ + aggregate: this.collName, + // We use a rooted $or query to cause plan selection to use the subplanner and thus + // yield. + pipeline: [{$match: {$or: [{a: 0}, {b: 0}]}}], + cursor: {} + }); + + if (!res.ok) { + return; + } + + var cursor = new DBCommandCursor(db.getMongo(), res); + try { + // No documents are ever inserted into the collection. + assertAlways.eq(0, cursor.itcount()); + } catch (e) { + // Ignore errors due to the plan executor being killed. + } + }; + + return $config; +}); diff --git a/jstests/concurrency/fsm_workloads/kill_rooted_or.js b/jstests/concurrency/fsm_workloads/kill_rooted_or.js index 01383e05411..c74e3b05e87 100644 --- a/jstests/concurrency/fsm_workloads/kill_rooted_or.js +++ b/jstests/concurrency/fsm_workloads/kill_rooted_or.js @@ -29,7 +29,8 @@ var $config = (function() { query: function query(db, collName) { var cursor = db[this.collName].find({$or: [{a: 0}, {b: 0}]}); try { - assert.eq(0, cursor.itcount()); + // No documents are ever inserted into the collection. + assertAlways.eq(0, cursor.itcount()); } catch (e) { // Ignore errors due to the plan executor being killed. } |