diff options
author | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-09-08 09:48:29 -0400 |
---|---|---|
committer | Max Hirschhorn <max.hirschhorn@mongodb.com> | 2016-09-08 09:48:29 -0400 |
commit | 284c0eca4941a450a473267b54aef03ba419f993 (patch) | |
tree | 4e274ff5a0b6db7a7cd519899397a7e06b5ebff6 /jstests | |
parent | 81b92cff01eee65a039d0cb74fbd3b312f95ddec (diff) | |
download | mongo-284c0eca4941a450a473267b54aef03ba419f993.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.
(cherry picked from commit 82cd8943dab085447ee180d4d59c2c5da778c523)
Diffstat (limited to 'jstests')
-rw-r--r-- | jstests/concurrency/fsm_workloads/kill_aggregation.js | 47 | ||||
-rw-r--r-- | jstests/concurrency/fsm_workloads/kill_rooted_or.js | 3 |
2 files changed, 49 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..f1260f10a96 --- /dev/null +++ b/jstests/concurrency/fsm_workloads/kill_aggregation.js @@ -0,0 +1,47 @@ +'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 e05bff72d40..0275bc774ac 100644 --- a/jstests/concurrency/fsm_workloads/kill_rooted_or.js +++ b/jstests/concurrency/fsm_workloads/kill_rooted_or.js @@ -24,7 +24,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. } |