Unable to drop shared database "ns not found"

1,896 views
Skip to first unread message

Simone Sciarrati

unread,
Sep 22, 2014, 6:15:31 AM9/22/14
to mongod...@googlegroups.com
Hi,

I am unable to drop a database in our cluster, when I try to drop the
database I get the error:

"exception: Dropping collection failed on the following hosts:
set1/mongo1.domain.net:27019: { errmsg: \"ns not found\", ok: 0.0 },
set2/mongo2.domain.net:27019: { errmsg: \"ns not found\", ok: 0.0 }"

If I run show dbs on mongo1.domain.net:27019 the db is there.

If I query the config db I don't find the database named 'aggregate':

mongos> db.databases.find({"_id": /aggregate/})
{ "_id" : "aggregate_2", "partitioned" : false, "primary" : "shard0001" }

Note that aggregate_2 is not the one I am after.

Although the database is not in the config I can still see chunks:

mongos> db.chunks.find({"ns": /aggregate\./}).count()
2271

No chunks associated with aggregate_2:

mongos> db.chunks.find({"ns": /aggregate_2/}).count()
0

The main side effect of this is that the balancer wastes a lot of time
trying to move chunks from a database that doesn't exist anymore. And
the other side effect is that I have to keep this db lingering around
even though it doesn't have any data in it.

I have stopped the balancer and tried creating collections and
inserting data in the database and then dropping it, also tried to
force the mongos to reload the config but this db just doesn't want to
die.

How do I get out of this situation? Should I remove the chunks from
the config db? Then drop the db from each shard?

Thanks,

S

Simone Sciarrati

unread,
Sep 23, 2014, 3:19:07 AM9/23/14
to mongod...@googlegroups.com
HI,

Any suggestion? Is it safe to just delete all chunks associated with
the non existing database?

Thanks,

S

Asya Kamsky

unread,
Sep 27, 2014, 11:53:55 PM9/27/14
to mongodb-user

You seem to be mixing talking about db and collection - which one are you trying to drop?

In general if you *know* nothing can/should be using this collection or db it should be safe to clean up manually - this scenario can happen if either something went wrong the first time you tried to drop collection through mongos or if someone tried to do it directly on the shards.

Asya

--
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: http://www.mongodb.org/about/support/.
---
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user...@googlegroups.com.
To post to this group, send email to mongod...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOQTPw5MmG1Cr0B6_YS_zfk2fNuQewDmDoTbLfqN8EnXLC5ENA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Simone Sciarrati

unread,
Sep 28, 2014, 6:44:16 AM9/28/14
to mongod...@googlegroups.com
Hi Asya,

Thanks for your reply.

The main issue is that the balancer is trying to move chunks for a
collection that belongs to a database that doesn't exist any longer in
config.databases. This means the balancer is wasting a lot of time and
any attempt to move any of those chunks obviously fails.

I am not sure how we got in this situation in the first place, I would
imagine that the only way we could end up with a list of chunks for a
collection in a non existing database is if something went wrong while
dropping the database through the mongos, perhaps the drop command
succeeded removing the database from config.databases but there was an
error before it could also remove all chunks for all the collections
in the database.

Regardless, that database shouldn't exist and so there shouldn't be
any chunk associated with any of its collection, therefore as you
suggest, I will go ahead and manually cleanup the mess.

Thanks,

S
> https://groups.google.com/d/msgid/mongodb-user/CAOe6dJD%2BrWGBVFMg56Fh5zHz0aEU%2BfHr5gqEVbRoaJhA4J70hQ%40mail.gmail.com.

Asya Kamsky

unread,
Sep 28, 2014, 2:20:45 PM9/28/14
to mongodb-user
It's possible that the balancer is still running from previous round
(in other words, it hasn't finished whatever round of balancing it was
on before, and so it has stale metadata - though that really shouldn't
happen).

One thing you can do is force all mongos processes to refresh their
configs via restart or flushRouterConfig command...

Asya
> To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOQTPw7U5kCnA9KERwRzBW2pCgSrVZ8k7POiAHBoyaYE_VrJ3w%40mail.gmail.com.

Simone Sciarrati

unread,
Sep 28, 2014, 6:20:37 PM9/28/14
to mongod...@googlegroups.com
Hi,

Thanks for the suggestion, I have already tried that, also stopped the
balancer and made sure it was not running, but it didn't help. I think
the only option left is to manually clear config.chunks.

Ciao,

S
> To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAOe6dJCdK6N2jN1C0uswNs1YEmAgpLowZdkMTq6rNf7U%2B4g7pg%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages