[SERVER-9496] Drop sharded collection the drop of sharded db leaves data on non-primary shards Created: 29/Apr/13  Updated: 07/Jun/13  Resolved: 07/Jun/13

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

Type: Improvement Priority: Major - P3
Reporter: David Hows Assignee: Unassigned
Resolution: Duplicate Votes: 1
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: File drop_sharded_db_col.js    
Issue Links:
Duplicate
duplicates SERVER-4537 better protect all sharding admin ope... Closed
Participants:

 Description   

Assuming 2+ shards

Repro Steps:

sh.enableSharding("foo");
sh.shardCollection("foo.bar", {x:1});
for(i=0;i<500000;i++){db.getSiblingDB("foo").bar.insert({x:i});}
//For Migrations
sleep(60);
db.getSiblingDB("foo").bar.drop();
db.getSiblingDB("foo").dropDatabase();

Check and confirm on the shard servers the amount of data remaining.

Primary shard will have no data for this database.

Secondary shards will still have db files existing as the MongoS did not route the drop command to these shards.

The drop of the database should be routed to the non-primary shards to cleanup. We should do some preflight checks before the drop and then use that to help determine where the drops are needed.



 Comments   
Comment by David Hows [ 29/Apr/13 ]

Its an edge case, no doubt. But surely something we can do some checks for.

What if there is data in other collections there?

I assume you mean non-sharded collections? If so, this would apply on the primary shard as well.

I'm a little confused by your comments starting with "Primary shard will be empty". Perhaps writing this as jstest will make it more clear exactly what you expect to happen and for the behaviors to be.

I've re-worded that bit and attached a JStest.

I think what you are describing is that the collections are removed but the db isn't dropped on shards which only had sharded collections.

Correct.

Comment by Scott Hernandez (Inactive) [ 29/Apr/13 ]

What if there is data in other collections there?

I'm a little confused by your comments starting with "Primary shard will be empty". Perhaps writing this as jstest will make it more clear exactly what you expect to happen and for the behaviors to be.

I think what you are describing is that the collections are removed but the db isn't dropped on shards which only had sharded collections.

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