[SERVER-10258] Allow previously removed shards to be added again Created: 19/Jul/13  Updated: 26/Oct/23

Status: Backlog
Project: Core Server
Component/s: None
Affects Version/s: 2.4.5
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Remon van Vliet Assignee: Backlog - Catalog and Routing
Resolution: Unresolved Votes: 2
Labels: oldshardingemea
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to DOCS-11994 Add procedure for re-adding a removed... Closed
Assigned Teams:
Catalog and Routing
Participants:

 Description   

Currently it is not possible to invoke a removeShard command on a specific machine and add it again at a later time without removing the datafiles due to the following error :

"errmsg" : "can't add shard localhost:27022 because a local database 'test' exists in another shard0000:localhost:27021"

I understand mongo cannot simply remove the database from the removed shard for a variety of reasons but I think the validation step to determine if the shard to be added is "clean" can be improved. I would assume iterating over all partitioned = true database on the new shard and for each iterating on all sharded collections to check if they're empty should be as safe a check and would allow subsequent removeShard->addShard without further intervention.



 Comments   
Comment by Kevin Rice [ 15/Oct/17 ]

In order to resolve a hot-shard issue, I have done a removeShard() to completion. Now, I want to add that shard back. But, instead, I get the complaint that:

mongos> sh.addShard("shard01/<myhostname_here_01>:<portnum_01>");

{ "code" : 96, "ok" : 0, "errmsg" : "can't add shard 'shard01/<myhostname_here_01>:<portnum_01>' because a local database 'megamaid' exists in another shard04" }

This is UNHELPFUL, I don't have instructions on how to proceed here. How do I get back to being able to add this shard back in?

Generated at Thu Feb 08 03:22:42 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.