[MDEV-31606] Refactor check_db_name() to get a const argument Created: 2023-07-03  Updated: 2023-10-17  Resolved: 2023-10-17

Status: Closed
Project: MariaDB Server
Component/s: Character Sets
Fix Version/s: 11.3.0

Type: Task Priority: Critical
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-27490 Allow full utf8mb4 for identifiers Stalled
is blocked by MDEV-31948 Add class DBNameBuffer, split check_d... Closed
is blocked by MDEV-31950 Cleanup: Move MEM_ROOT allocation met... Closed
is blocked by MDEV-31954 Cleanup in check_table_name() and che... Closed
is blocked by MDEV-31972 Change parameter of make_sp_name*() f... Closed
is blocked by MDEV-31974 Remove global function normalize_db_n... Closed
is blocked by MDEV-31978 Turn ok_for_lower_case_names() to a m... Closed
is blocked by MDEV-31982 Remove old check_db_name() from prepa... Closed
is blocked by MDEV-31986 Remove old check_db_name() from make_... Closed
is blocked by MDEV-31989 Cleanup Lex_ident_fs::check_body() Closed
is blocked by MDEV-31991 Split class Database_qualified_name Closed
is blocked by MDEV-31992 Automatic conversion from LEX_STRING ... Closed
is blocked by MDEV-32002 Remove my_casedn_str() in append_iden... Closed
is blocked by MDEV-32013 Add Field::val_lex_string_strmake() Closed
is blocked by MDEV-32019 Replace my_casedn_str(local_buffer) t... Closed
is blocked by MDEV-32026 lowercase_table2.test failures in 11.3 Closed
is blocked by MDEV-32081 Remove my_casedn_str() from get_canon... Closed

 Description   

This task was originally a part of MDEV-31531, but now is a separate task, because it'll be quite a big change itself.

check_db_name() converts the argument to lower case if lower_case_table_name>0.
It uses my_casedn_str(), which converts the data to lower case in-place. As far as in-place conversion won't be possible after we switch to Unicode-14 casefolding rules (because conversion to lower case can increase the string length in Unicode-14), we need to refactor all uses of check_db_name() not to use in-place casefolding conversion.

The current implementation of:

bool check_db_name(LEX_STRING *db);

should be changed to get a constant argument:

bool check_db_name(const LEX_CSTRING &db);

All old-style check_db_name() use cases should be changed in the way that in case of lower_case_table_names>1 the following sequence is done:

  • Convert an existing database name to a new database name in lower case into a NEW memory location.
  • Call the NEW version of check_db_name() on the NEW memory location.


 Comments   
Comment by Alexander Barkov [ 2023-07-05 ]

Hello Dmitry, please review a patch in bb-10.11-bar-MDEV-31606. Thanks.

Comment by Dmitry Shulga [ 2023-09-08 ]

Approved

Comment by Alexander Barkov [ 2023-09-13 ]

Pushed to 11.3

Comment by Ramesh Sivaraman [ 2023-10-10 ]

ok to push

Generated at Thu Feb 08 10:25:08 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.