-
Type:
Bug
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: 7.0.26
-
Component/s: None
-
Catalog and Routing
-
ALL
-
🟩 Routing and Topology
-
None
-
None
-
None
-
None
-
None
-
None
I wanted to remove a Shard but after running
db.adminCommand({ removeShard: 'shard_07'})
 draining started but never finished.Â
Â
After some time I found the reason. For some collections I did a sh.disableBalancing('<namespace>') which caused the draining to hang.
Of course, this behavior is not a bug, however the user does not get any indication why shard removing never finishes.
It should be reflected in the output of removeShard command, maybe like this:
{
 msg: 'draining ongoing',
 state: 'ongoing',
 remaining: { chunks: Long('28'), dbs: Long('0'), jumboChunks: Long('0') },
 note: 'you need to drop or movePrimary these databases',
 dbsToMove: [],
 balancer_note: 'you need to enableBalancing on these collections',
 lockedCollections: ['data.sessions.20251112']
 ok: 1
}
Â
At least, it should be mentioned in the documentation Remove Shards from a Sharded Cluster. Maybe like this:
Steps
- Ensure the balancer is enabled
... - Ensure balancing is enabled on collections
Run commanddb.getSiblingDB("config").collections.find({noBalance: true})
If output is not empty, then run sh.enableBalancing('<namespace>') on these collections
- Â
Migrate sharded collection data with the balancer
...
Â
Â