您的位置:首页 > 编程语言 > Go语言

mongos删除库表的一个bug

2017-03-06 15:50 295 查看
ISSUE SUMMARY

When dropping a database / collection in a sharded cluster, even if the drop is reported as successful it is possible the database / collection may still be present in some nodes in the cluster. At this time, we do not recommend that users drop a database or
collection and then attempt to reuse the namespace.

USER IMPACT

When the database/collection is not successfully dropped in a given node, the corresponding files continue to use disk space in that node. Attempting to reuse the namespace may lead to undefined behavior.

WORKAROUNDS

To work around this issue one can follow the steps below to drop a database/collection in a sharded environment:
Drop the database / collection using a mongos
Connect to each shard's primary and verify the namespace has been dropped. If it has not, please drop it. Dropping a database (e.g db.dropDatabase()) removes the data files on disk for the database being dropped.
Connect to a mongos, switch to the config database and remove any reference to the removed namespace from the collections chunks, locks, databases and collections:

When dropping a database:
use config

db.collections.remove( { _id: /^DATABASE\./ } )

db.databases.remove( { _id: "DATABASE" } )

db.chunks.remove( { ns: /^DATABASE\./ } )

db.locks.remove( { _id: /^DATABASE\./ } )

When dropping a collection:
use config

db.collections.remove( { _id: "DATABASE.COLLECTION" } )

db.chunks.remove( { ns: "DATABASE.COLLECTION" } )

db.locks.remove( { _id: "DATABASE.COLLECTION" } )

Connect to each mongos and run flushRouterConfig

PS:也遭遇了,真坑,原文链接https://jira.mongodb.org/browse/SERVER-17397
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: