[SERVER-4954] Dropping a database of a sharded cluster that contains regex characters will not cleanup config docs Created: 13/Feb/12  Updated: 11/Jul/16  Resolved: 21/Feb/12

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: 1.8.4
Fix Version/s: 2.1.1

Type: Bug Priority: Major - P3
Reporter: Randolph Tan Assignee: Randolph Tan
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Operating System: ALL
Participants:

 Description   

Preparation: Create a database named "[a-z]+" and create a collection name "test" and shard it.

From the mongo shell (connected to mongos):

1. db.getSiblingDB("[a-z]+").dropDatabase();
2. use config
3. db.databases.find() // [a-z]+ is not listed -> OK
4. db.collections.find() // [a-z]+.test is still there -> BUG



 Comments   
Comment by auto [ 17/Feb/12 ]

Author:

{u'login': u'renctan', u'name': u'Ren', u'email': u'renctan@gmail.com'}

Message: Changes to address code review comments for SERVER-4954
Branch: master
https://github.com/mongodb/mongo/commit/c70f2d58ab352997776556d25bb258eea09e1a4d

Comment by auto [ 17/Feb/12 ]

Author:

{u'login': u'renctan', u'name': u'Ren', u'email': u'renctan@gmail.com'}

Message: fixed wrong test for SERVER-4954
Branch: master
https://github.com/mongodb/mongo/commit/8b833b9a759b0b3c1f058908c38066e1d8f961fb

Comment by auto [ 17/Feb/12 ]

Author:

{u'login': u'renctan', u'name': u'Ren', u'email': u'renctan@gmail.com'}

Message: SERVER-4954 Dropping a database of a sharded cluster that contains regex characters will not cleanup config docs

More detail explanation of cause:
When DBConfig::dropDatabase gets called, it will then call _dropShardedCollections. However, the collections that will get cleaned up is based from the _collections member variable, which is prepopulated with unescaped regex query at _load.
Branch: master
https://github.com/mongodb/mongo/commit/359803779413dd3f17ef1f9f5910a03b1163f283

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