Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-33108

TABLE_STATISTICS and INDEX_STATISTICS are case insensitive with lower-case-table-names=0

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.4, 11.4
    • 10.4, 11.4
    • Character Sets
    • None

    Description

      I execute the following SQL script with a Linux MariaDB server running with --lower-case-table-names=0:

      SET GLOBAL userstat=1;
      CREATE TABLE t1 (a INT, KEY(a));
      INSERT INTO t1 VALUES (1),(2),(3),(4);
      SELECT * FROM t1 ORDER BY a;
      CREATE TABLE T1 (a INT, KEY(a));
      INSERT INTO T1 VALUES (1),(2),(3),(4);
      SELECT * FROM T1 ORDER BY a;
      

      +--------------+------------+-----------+--------------+------------------------+
      | TABLE_SCHEMA | TABLE_NAME | ROWS_READ | ROWS_CHANGED | ROWS_CHANGED_X_INDEXES |
      +--------------+------------+-----------+--------------+------------------------+
      | test         | T1         |         1 |            1 |                      1 |
      +--------------+------------+-----------+--------------+------------------------+
      

      Looks wrong. The statistics for t1 and T1 should have separate records.

      INDEX_STATISTICS has the same problem:

      SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS;
      

      +--------------+------------+------------+-----------+
      | TABLE_SCHEMA | TABLE_NAME | INDEX_NAME | ROWS_READ |
      +--------------+------------+------------+-----------+
      | test         | T1         | a          |         1 |
      +--------------+------------+------------+-----------+
      

      The problem is in these function in sql_connect.cc:

      void init_global_table_stats(void)
      {
        my_hash_init(PSI_INSTRUMENT_ME, &global_table_stats, system_charset_info,
                     max_connections, 0, 0, (my_hash_get_key) get_key_table_stats,
                    (my_hash_free_key) free_table_stats, 0);
      }
      

      void init_global_index_stats(void)
      {
        my_hash_init(PSI_INSTRUMENT_ME, &global_index_stats, system_charset_info,
                     max_connections, 0, 0, (my_hash_get_key) get_key_index_stats,
                     (my_hash_free_key) free_index_stats, 0);
      }
      

      Attachments

        Activity

          People

            bar Alexander Barkov
            bar Alexander Barkov
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.