Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-72292

Regex bug in dropDatabase in Sharded cluster

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.3.0-rc0
    • Affects Version/s: None
    • Component/s: Sharding
    • Labels:
      None
    • Sharding EMEA
    • Fully Compatible
    • ALL
    • Hide

      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

       

      Show
      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  
    • Sharding EMEA 2022-12-26

      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. 

            Assignee:
            pol.pinol@mongodb.com Pol Pinol
            Reporter:
            huan.li@mongodb.com Huan Li
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: