-
Type: Investigation
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
5
-
TAR 2023-05-01, TAR 2023-05-15
-
563
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.
- depends on
-
SERVER-75942 Check that database name is valid UTF-8 when creating a new database
- In Progress
-
SERVER-76793 Warn when database names are invalid UTF-8
- Closed