From cccb34c66a14bb335c60fe57ed8376ada8b0326c Mon Sep 17 00:00:00 2001 From: Bernard Gorman Date: Mon, 31 Jul 2017 00:33:31 +0100 Subject: SERVER-30084 Validate that at least one shard is present when running collectionless aggregations on mongos --- jstests/aggregation/bugs/server30084.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 jstests/aggregation/bugs/server30084.js (limited to 'jstests') diff --git a/jstests/aggregation/bugs/server30084.js b/jstests/aggregation/bugs/server30084.js new file mode 100644 index 00000000000..926b032e229 --- /dev/null +++ b/jstests/aggregation/bugs/server30084.js @@ -0,0 +1,18 @@ +/** + * Test that running a $currentOp aggregation on a cluster with no shards returns an empty result + * set, and does not cause the mongoS floating point failure described in SERVER-30084. + */ +(function() { + const st = new ShardingTest({shards: 0, config: 1}); + + const adminDB = st.s.getDB("admin"); + + assert.commandWorked( + adminDB.runCommand({aggregate: 1, pipeline: [{$currentOp: {}}], cursor: {}})); + assert.commandWorked(adminDB.currentOp()); + + assert.eq(adminDB.aggregate([{$currentOp: {}}]).itcount(), 0); + assert.eq(adminDB.currentOp().inprog.length, 0); + + st.stop(); +})(); \ No newline at end of file -- cgit v1.2.1