mirror of
https://github.com/mongodb/mongo.git
synced 2024-12-01 01:21:03 +01:00
SERVER-38933 currentOp is not resilient to drop shard
This commit is contained in:
parent
18c4eaee71
commit
08408f7893
@ -25,6 +25,7 @@ selector:
|
||||
- jstests/sharding/basic_merge.js
|
||||
- jstests/sharding/count1.js
|
||||
- jstests/sharding/count2.js
|
||||
- jstests/sharding/current_op_with_drop_shard.js
|
||||
- jstests/sharding/cursor1.js
|
||||
- jstests/sharding/diffservers1.js
|
||||
- jstests/sharding/disable_autosplit.js
|
||||
|
25
jstests/sharding/current_op_with_drop_shard.js
Normal file
25
jstests/sharding/current_op_with_drop_shard.js
Normal file
@ -0,0 +1,25 @@
|
||||
// Tests that currentOp is resilient to drop shard.
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
const st = new ShardingTest({shards: 2, rs: {nodes: 1}});
|
||||
|
||||
// We need the balancer to remove a shard.
|
||||
st.startBalancer();
|
||||
|
||||
const mongosDB = st.s.getDB(jsTestName());
|
||||
const shardName = st.shard0.shardName;
|
||||
|
||||
var res = st.s.adminCommand({removeShard: shardName});
|
||||
assert.commandWorked(res);
|
||||
assert.eq('started', res.state);
|
||||
assert.soon(function() {
|
||||
res = st.s.adminCommand({removeShard: shardName});
|
||||
assert.commandWorked(res);
|
||||
return ('completed' === res.state);
|
||||
}, "removeShard never completed for shard " + shardName);
|
||||
|
||||
assert.commandWorked(mongosDB.currentOp());
|
||||
|
||||
st.stop();
|
||||
})();
|
@ -441,6 +441,9 @@ MongoSInterface::DispatchShardPipelineResults MongoSInterface::dispatchShardPipe
|
||||
if (!shardRegistry->reload(opCtx)) {
|
||||
shardRegistry->reload(opCtx);
|
||||
}
|
||||
// Rebuild the set of shards as the shard registry might have changed.
|
||||
shardIds = getTargetedShards(
|
||||
opCtx, mustRunOnAll, executionNsRoutingInfo, shardQuery, aggRequest.getCollation());
|
||||
}
|
||||
|
||||
// Explain does not produce a cursor, so instead we scatter-gather commands to the shards.
|
||||
|
Loading…
Reference in New Issue
Block a user