[MDEV-32590] Opened_table_definitions is counted wrong Created: 2023-10-26  Updated: 2023-11-03

Status: Confirmed
Project: MariaDB Server
Component/s: Information Schema
Affects Version/s: 10.4, 10.5, 10.6, 10.7, 10.8, 10.9, 10.10, 10.11, 11.0, 11.1, 11.2, 11.3
Fix Version/s: 10.11, 11.0, 11.1, 11.2, 11.3

Type: Bug Priority: Minor
Reporter: Oli Sennhauser Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: status
Environment:

Linux n.a.



 Description   

Opened_table_definitions server status is not counted correctly. It should NEVER be smaller than Open_table_definitions. But is is. This means some table definion opens are not counted correctly. It concerns at least sys schema tables (views):

SQL> SHOW  GLOBAL STATUS LIKE 'open%table%';
+--------------------------+-------+
| Variable_name            | Value |
+--------------------------+-------+
| Open_table_definitions   | 164   |
| Opened_table_definitions | 62    | -> 102 missing -> sys tables!
+--------------------------+-------+
 
SQL> > SHOW OPEN TABLES;
+----------+-----------------------------------------------+--------+-------------+
| Database | Table                                         | In_use | Name_locked |
+----------+-----------------------------------------------+--------+-------------+
| sys      | x$user_summary_by_statement_latency           |      0 |           0 |
| sys      | schema_table_lock_waits                       |      0 |           0 |
| sys      | x$host_summary_by_statement_latency           |      0 |           0 |
| sys      | x$ps_digest_95th_percentile_by_avg_us         |      0 |           0 |
| sys      | memory_global_total                           |      0 |           0 |
| sys      | x$user_summary                                |      0 |           0 |
| sys      | x$host_summary                                |      0 |           0 |
| sys      | schema_object_overview                        |      0 |           0 |
| sys      | statement_analysis                            |      0 |           0 |
| sys      | session_ssl_status                            |      0 |           0 |
| sys      | waits_by_user_by_latency                      |      0 |           0 |
| sys      | waits_by_host_by_latency                      |      0 |           0 |
| sys      | innodb_buffer_stats_by_table                  |      0 |           0 |
| sys      | memory_global_by_current_bytes                |      0 |           0 |
| sys      | ps_check_lost_instrumentation                 |      0 |           0 |
| sys      | schema_table_statistics_with_buffer           |      0 |           0 |
| sys      | processlist                                   |      0 |           0 |
| sys      | sys_config                                    |      0 |           0 |
| sys      | host_summary_by_stages                        |      0 |           0 |
| sys      | user_summary_by_stages                        |      0 |           0 |
| sys      | x$wait_classes_global_by_latency              |      0 |           0 |
| sys      | x$memory_global_by_current_bytes              |      0 |           0 |
| sys      | x$user_summary_by_file_io                     |      0 |           0 |
| sys      | x$host_summary_by_file_io                     |      0 |           0 |
| sys      | x$ps_digest_avg_latency_distribution          |      0 |           0 |
| sys      | statements_with_sorting                       |      0 |           0 |
| sys      | schema_unused_indexes                         |      0 |           0 |
| sys      | x$statements_with_temp_tables                 |      0 |           0 |
| sys      | x$innodb_buffer_stats_by_schema               |      0 |           0 |
| sys      | statements_with_runtimes_in_95th_percentile   |      0 |           0 |
| sys      | io_global_by_file_by_bytes                    |      0 |           0 |
| sys      | x$session                                     |      0 |           0 |
| sys      | io_global_by_wait_by_bytes                    |      0 |           0 |
| sys      | x$wait_classes_global_by_avg_latency          |      0 |           0 |
| sys      | host_summary_by_statement_type                |      0 |           0 |
| sys      | user_summary_by_statement_type                |      0 |           0 |
| sys      | x$user_summary_by_file_io_type                |      0 |           0 |
| sys      | x$host_summary_by_file_io_type                |      0 |           0 |
| sys      | latest_file_io                                |      0 |           0 |
| sys      | x$statements_with_full_table_scans            |      0 |           0 |
| sys      | io_global_by_wait_by_latency                  |      0 |           0 |
| sys      | statements_with_errors_or_warnings            |      0 |           0 |
| sys      | io_global_by_file_by_latency                  |      0 |           0 |
| sys      | schema_table_statistics                       |      0 |           0 |
| sys      | statements_with_temp_tables                   |      0 |           0 |
| sys      | x$memory_by_thread_by_current_bytes           |      0 |           0 |
| sys      | x$statements_with_runtimes_in_95th_percentile |      0 |           0 |
| sys      | x$statement_analysis                          |      0 |           0 |
| sys      | wait_classes_global_by_avg_latency            |      0 |           0 |
| sys      | user_summary_by_file_io_type                  |      0 |           0 |
| sys      | host_summary_by_file_io_type                  |      0 |           0 |
| sys      | x$processlist                                 |      0 |           0 |
| sys      | statements_with_full_table_scans              |      0 |           0 |
| sys      | x$waits_by_user_by_latency                    |      0 |           0 |
| sys      | x$waits_by_host_by_latency                    |      0 |           0 |
| sys      | host_summary                                  |      0 |           0 |
| sys      | user_summary                                  |      0 |           0 |
| sys      | x$io_global_by_wait_by_bytes                  |      0 |           0 |
| sys      | version                                       |      0 |           0 |
| sys      | x$statements_with_errors_or_warnings          |      0 |           0 |
| sys      | x$io_global_by_file_by_bytes                  |      0 |           0 |
| sys      | x$latest_file_io                              |      0 |           0 |
| sys      | x$innodb_buffer_stats_by_table                |      0 |           0 |
| sys      | session                                       |      0 |           0 |
| sys      | x$host_summary_by_statement_type              |      0 |           0 |
| sys      | x$user_summary_by_statement_type              |      0 |           0 |
| sys      | schema_redundant_indexes                      |      0 |           0 |
| sys      | x$schema_table_statistics_with_buffer         |      0 |           0 |
| sys      | x$host_summary_by_stages                      |      0 |           0 |
| sys      | x$io_global_by_wait_by_latency                |      0 |           0 |
| sys      | wait_classes_global_by_latency                |      0 |           0 |
| sys      | x$user_summary_by_stages                      |      0 |           0 |
| sys      | x$io_global_by_file_by_latency                |      0 |           0 |
| sys      | x$memory_global_total                         |      0 |           0 |
| sys      | x$schema_tables_with_full_table_scans         |      0 |           0 |
| sys      | innodb_lock_waits                             |      0 |           0 |
| sys      | innodb_buffer_stats_by_schema                 |      0 |           0 |
| sys      | schema_auto_increment_columns                 |      0 |           0 |
| sys      | x$schema_table_lock_waits                     |      0 |           0 |
| sys      | x$schema_flattened_keys                       |      0 |           0 |
| sys      | x$memory_by_host_by_current_bytes             |      0 |           0 |
| sys      | x$memory_by_user_by_current_bytes             |      0 |           0 |
| sys      | memory_by_thread_by_current_bytes             |      0 |           0 |
| sys      | x$io_by_thread_by_latency                     |      0 |           0 |
| sys      | x$waits_global_by_latency                     |      0 |           0 |
| sys      | schema_index_statistics                       |      0 |           0 |
| sys      | x$ps_schema_table_statistics_io               |      0 |           0 |
| sys      | memory_by_host_by_current_bytes               |      0 |           0 |
| sys      | memory_by_user_by_current_bytes               |      0 |           0 |
| sys      | metrics                                       |      0 |           0 |
| sys      | x$statements_with_sorting                     |      0 |           0 |
| sys      | host_summary_by_file_io                       |      0 |           0 |
| sys      | x$schema_table_statistics                     |      0 |           0 |
| sys      | x$schema_index_statistics                     |      0 |           0 |
| sys      | schema_tables_with_full_table_scans           |      0 |           0 |
| sys      | io_by_thread_by_latency                       |      0 |           0 |
| sys      | waits_global_by_latency                       |      0 |           0 |
| sys      | x$innodb_lock_waits                           |      0 |           0 |
| sys      | user_summary_by_file_io                       |      0 |           0 |
| sys      | user_summary_by_statement_latency             |      0 |           0 |
| sys      | host_summary_by_statement_latency             |      0 |           0 |
| mysql    | servers                                       |      0 |           0 |
| foodmart | sessions                                      |      0 |           0 |
| foodmart | reserve_employee                              |      0 |           0 |
| world    | Country                                       |      0 |           0 |
| mysql    | procs_priv                                    |      0 |           0 |
| mysql    | table_stats                                   |      0 |           0 |
| mysql    | index_stats                                   |      0 |           0 |
| mysql    | plugin                                        |      0 |           0 |
| foodmart | employee                                      |      0 |           0 |
| foodmart | product                                       |      0 |           0 |
| foodmart | category                                      |      0 |           0 |
| foodmart | currency                                      |      0 |           0 |
| mysql    | time_zone_transition                          |      0 |           0 |
| foodmart | promotion                                     |      0 |           0 |
| mysql    | time_zone_leap_second                         |      0 |           0 |
| world    | CountryLanguage                               |      0 |           0 |
| mysql    | time_zone                                     |      0 |           0 |
| foodmart | days                                          |      0 |           0 |
| mysql    | wsrep_streaming_log                           |      0 |           0 |
| foodmart | salary                                        |      0 |           0 |
| mysql    | help_category                                 |      0 |           0 |
| foodmart | department                                    |      0 |           0 |
| mysql    | general_log                                   |      0 |           0 |
| mysql    | user                                          |      0 |           0 |
| mysql    | roles_mapping                                 |      0 |           0 |
| mysql    | time_zone_transition_type                     |      0 |           0 |
| mysql    | proxies_priv                                  |      0 |           0 |
| mysql    | event                                         |      0 |           0 |
| mysql    | columns_priv                                  |      0 |           0 |
| mysql    | wsrep_cluster_members                         |      0 |           0 |
| percona  | checksums                                     |      0 |           0 |
| world    | City                                          |      0 |           0 |
| mysql    | proc                                          |      0 |           0 |
| mysql    | help_keyword                                  |      0 |           0 |
| mysql    | func                                          |      0 |           0 |
| foodmart | sales_fact                                    |      0 |           0 |
| mysql    | time_zone_name                                |      0 |           0 |
| mysql    | db                                            |      0 |           0 |
| mysql    | slow_log                                      |      0 |           0 |
| foodmart | time_by_day                                   |      0 |           0 |
| foodmart | inventory_fact                                |      0 |           0 |
| foodmart | store                                         |      0 |           0 |
| foodmart | account                                       |      0 |           0 |
| foodmart | position                                      |      0 |           0 |
| foodmart | product_class                                 |      0 |           0 |
| mysql    | column_stats                                  |      0 |           0 |
| mysql    | help_topic                                    |      0 |           0 |
| foodmart | warehouse_class                               |      0 |           0 |
| mysql    | wsrep_allowlist                               |      0 |           0 |
| foodmart | expense_fact                                  |      0 |           0 |
| mysql    | help_relation                                 |      0 |           0 |
| test     | test                                          |      0 |           0 |
| mysql    | global_priv                                   |      0 |           0 |
| mysql    | tables_priv                                   |      0 |           0 |
| mysql    | wsrep_cluster                                 |      0 |           0 |
| foodmart | warehouse                                     |      0 |           0 |
| foodmart | basket                                        |      0 |           0 |
| foodmart | region                                        |      0 |           0 |
| foodmart | customer                                      |      0 |           0 |
| mysql    | gtid_slave_pos                                |      0 |           0 |
| mysql    | innodb_table_stats                            |      0 |           0 |
| mysql    | innodb_index_stats                            |      0 |           0 |
| mysql    | transaction_registry                          |      0 |           0 |
+----------+-----------------------------------------------+--------+-------------+



 Comments   
Comment by Sergei Golubchik [ 2023-11-03 ]

Right. Currently Open_table_definitions shows the number of entries in the table definition cache. SHOW OPEN TABLES shows entries in the table definition cache (note that it has returned exactly 164 rows). While Opened_table_definitions counts open binary .frm files.

At some point in time in the past, table definition cache started caching views too. And now Open_table_definitions includes views, but Opened_table_definitions still doesn't.

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