mongodb removeShard issue with config.system.session I have a staging mongodb 4.0.19 sharded cluster with 2 replica set shards . I want to remove one shard. I followed the documentation: https://docs.mongodb.com/v4.0/tutorial/remove-shards-from-cluster/index.html and used removeShard command.
But one chunk cannot be moved: the config.system.sessions chunk. I have the following error:
2020-07-30T09:21:07.330+0200 W SHARDING [conn21] Chunk move failed :: caused by :: OperationFailed: Data transfer error: migrate failed: InvalidUUID: Cannot create collection config.system.sessions because we already have an identically named collection with UUID b788097c-5ba1-464c-9064-0b7faed5c196, which differs from the donor's UUID 22588e86-20a2-4cdf-a70e-803fbd7b3e5a. Manually drop the collection on this shard if it contains data from a previous incarnation of config.system.sessions
This prevents draining chunks to finish. Is there any way to drop that collection or to force removeShard command to finish ?
If you login directly to that shard (and not mongos), you can drop that collection. After you have logged in to that shard, you can check with db.collection.find() command that there is no data what you want to save, before you drop it.