Uploaded image for project: 'MongoDB Database Tools'
  1. MongoDB Database Tools
  2. TOOLS-3286

Investigate changes in SERVER-75942: Check that database name is valid UTF-8 when creating a new database

    • Type: Icon: Investigation Investigation
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • 5
    • TAR 2023-05-01, TAR 2023-05-15
    • 562

      Original Downstream Change Summary

      This ticket has some interesting upgrade and migration (mongosync et al.) considerations. A user that somehow ends up with one of these bad UTF-8 database names will need to remove or rename them before upgrading.

      I am marking documentation changes as "Needed" as, if we make this change, we should update this page on MongoDB database name restrictions: https://www.mongodb.com/docs/manual/reference/limits/

      Description of Linked Ticket

      When running the attached [^bad_dbname.cpp]script with mongod, we allow the database name to have an invalid utf-8 character (eg. "name\xbc").

      When running with mongos, the sharding catalog manager checks if the dbName already exists. It also does a case insensitive match by filtering on the regex (https://github.com/10gen/mongo/blob/master/src/mongo/db/s/config/sharding_catalog_manager_database_operations.cpp/#L176-L180). In doing so, the regex fails with invalid utf-8 (https://github.com/10gen/mongo/blob/master/src/mongo/db/matcher/expression_leaf.cpp/#L245-L247).

      We should not allow creating a database with an invalid utf-8 in any of the cases.

      This was motivated by investigating  SERVER-57026 and HELP-43395. We should verify that after this change the invalid entries listed in the tickets cannot be created.

            Assignee:
            Unassigned Unassigned
            Reporter:
            backlog-server-pm Backlog - Core Eng Program Management Team
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated: