maria:bb-11.3-mdev-27277

Last commit made on 2023-09-11
Get this branch:
git clone -b bb-11.3-mdev-27277 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-11.3-mdev-27277
Repository:
lp:maria

Recent commits

6cd1809... by Oleg Smirnov

MDEV-27277 Add a warning when max_sort_length is reached

During a query execution some sorting and grouping operations
on strings may be involved. System variable max_sort_length defines
the maximum number of bytes to use when comparing strings during
sorting/grouping. Thus, the comparable parts of strings may be less
than their actual size, so the results of the query may be not
sorted/grouped properly.
To indicate that some comparisons were done on a truncated lengths,
a new warning has been introduced with this commit.

8951f7d... by Alexander Barkov

MDEV-31992 Automatic conversion from LEX_STRING to LEX_CSTRING

- Adding automatic conversion operator from LEX_STRING to LEX_CSTRING
  Now a LEX_STRING can be passed directly to any function expecting
  a LEX_CSTRING parameter passed by value or by reference.
- Removing a number of duplicate methods accepting LEX_STRING.
  Now the code used the LEX_CSTRING version.

9b0b314... by Alexander Barkov

MDEV-31991 Split class Database_qualified_name

- Moving some of Database_qualidied_name methods into a new class
  Identifier_chain2.

- Changing the data type of the following variables from
  Database_qualified_name to Identifier_chain2:

  * q_pkg_proc in LEX::call_statement_start()
  * q_pkg_func in LEX::make_item_func_call_generic()

Rationale:

The data type of Database_qualified_name::m_db will be changed
to Lex_ident_db soon. So Database_qualified_name won't be able
to store the `pkg.routine` part of `db.pkg.routine` any more,
because `pkg` must not depend on lower-case-table-names.

b541852... by Alexander Barkov

MDEV-31989 Cleanup Lex_ident_fs::check_body()

- Changing the data type of the global variable any_db from
  LEX_CSTRING to Lex_ident_db

- Removing the dependency on system_charset_info from
  Lex_ident_fs::check_body(), using my_charset_utf8mb3_general_ci directly,
  because system_charset_info is initialized much later than any_db.
  system_charset_info cannot be changed dynamically any way.

- Removing the unsed old code from Lex_ident_fs::check_body().
  This code was last used in MySQL-4.0 and won't be used in the future.

21218d3... by Alexander Barkov

MDEV-31986 Remove old check_db_name() from make_table_name_list()

- Replacing the old style inplace check_db_name() in make_table_name_list()
  to the new style non-modifying code
- Adding "const" qualifier to the "db" parameter to ha_discover_table_names()
  and its dependency functions.

d15e290... by Alexander Barkov

MDEV-31982 Remove check_db_name() from prepare_db_action()

- Adding a new class Lex_ident_db, to store normalized database names:
  lower-cased if lower-case-table-name says so,
  and checked to be a valid database name using Lex_ident_fs::check_db_name()

- Reusing the new class in parameters to functions:
    prepare_db_action()
    mysql_create_db()
    mysql_alter_db()
    mysql_rm_db()
    mysql_upgrade_db()

This change removed two old-style check_db_name() calls.

ebbf566... by Alexander Barkov

MDEV-31978 Turn ok_for_lower_case_names() to a method in Lex_ident_fs

- Changing the global function ok_for_lower_case_names()
  into a method in class Lex_ident_fs.

- Changing a few functions/methods to get the database name
  as a "const LEX_CSTRING" instead of a "const char *".
  All these functions/methods use ok_for_lower_case_names()
  inside. This change helps to avoid new strlen() calls, and also
  removes a few old strlen() calls.

7a7296b... by Alexander Barkov

MDEV-31974 Remove global function normalize_db_name()

The function normalize_db_name() fully repeated the functionality
of the class DBNameBuffer. This patch removes normalize_db_name()
and replaces it to a DBNameBuffer based code.

495c32d... by Alexander Barkov

MDEV-31972 Change parameter of make_sp_name*() from LEX_CSTRING to Lex_ident_sys_st

Changing LEX_CSTRING* parameters of LEX::make_sp_name() to Lex_ident_sys_st.

This makes the code clear because a value of Lex_ident_sys_st has
some guaranteed additional constraints over a base LEX_CSTRING:

- Its LEX_CSTRING::str is not NULL (sql_yacc.yy would abort otherwise)
- Its LEX_CSTRING::str is 0-terminated
- Its a valid utf8 string
- The string pointed by LEX_CSTRING::str was created on THD::mem_root

Also changing "pass by pointer" to "pass by reference",
as these parameters can never be NULL - they are Bison stack variables.

b956a6a... by Alexander Barkov

MDEV-31948 Add class DBNameBuffer, split check_db_name() into stages

- Adding a class Lex_ident_fs, to store identifiers for on-disk
  database objects, such as databases, tables, triggers.

- Moving the validation code from check_db_name()
  to non-modifying methods in Lex_ident_fs:

    Lex_ident_fs::check_body()
    Lex_ident_fs::check_db_name()

  Adding a new method Lex_ident_fs::check_db_name_with_error(),
  which performs validation and raises an error on validation failure.

  Unlike the old function check_db_name(), the new class Lex_ident_fs
  does not lower-case the identifier during the validation.
  Lower-casing must be done before calling Lex_ident_fs validation methods.

- Adding a low level helper template class CharBuffer which can:
  * store exact or lower-cased strings with a short fixed maximum length
  * return the value as a LEX_CSTRING efficiently

- Adding a helper template class DBNameBuffer (deriving from CharBuffer), to
  allocate optionally lower-cased database identifiers on stack when relevant.
  Useful for temporary values which don't need to be allocated on MEM_ROOT.

- Using DBNameBuffer in mysql_change_db()

- Using DBNameBuffer in show_create_db()