[SERVER-72292] Regex bug in dropDatabase in Sharded cluster Created: 20/Dec/22  Updated: 29/Oct/23  Resolved: 21/Dec/22

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 6.3.0-rc0

Type: Bug Priority: Major - P3
Reporter: Huan Li Assignee: Pol Pinol
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by SERVER-55398 Dropping a database should also drop ... Closed
Assigned Teams:
Sharding EMEA
Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Launch a sharded cluster with the latest master branch code. 
Run following 
> use db[]
switched to db db[]

> db.runCommand({dropDatabase: 1, writeConcern: {w: 'majority' }}) MongoServerError: Regular expression is invalid: missing terminating ] for character class

 

Sprint: Sharding EMEA 2022-12-26
Participants:

 Description   

We found in recent server build, the `dropDatabase` command failed with confusing errors

Enterprise [direct: mongos] db[]>  db.runCommand({dropDatabase: 1, writeConcern: {w: 'majority' }})
MongoServerError: Regular expression is invalid: missing terminating ] for character class 

After a discussion with arun.banala@mongodb.com , we found the problem was introduced in this commit https://github.com/mongodb/mongo/commit/fd2dd311397aa3671e69ae4e4d98056e8006620f

In the commit, it seems the special characters inside the database name weren't escaped when constructing a regex to match the other databases. 

Please prioritize the fix for this issue otherwise we will not be able to drop the database with special characters in a sharding cluster. Thx. 


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