[MDEV-5943] 'show table status' does not immediately show tokudb tables Created: 2014-03-24  Updated: 2014-03-26  Resolved: 2014-03-26

Status: Closed
Project: MariaDB Server
Component/s: None
Affects Version/s: 10.0.9
Fix Version/s: 10.0.10

Type: Bug Priority: Minor
Reporter: Rich Prohaska Assignee: Sergei Golubchik
Resolution: Fixed Votes: 0
Labels: None
Environment:

centos 6.2 debug build of mariadb 10.0.9


Issue Links:
Duplicate
is duplicated by MDEV-5839 TokuDB tables not properly cleaned on... Closed

 Description   

mysql> install plugin tokudb soname 'ha_tokudb.so';
Query OK, 0 rows affected (0.07 sec)
 
mysql> create table t (id int primary key) engine=tokudb;
Query OK, 0 rows affected (0.11 sec)
 
mysql> show table status;
Empty set (0.00 sec)
 
and no data/test/t.frm file
 
mysql> show create table t;
+-------+---------------------------------------------------------------------------------------------------------+
| Table | Create Table                                                                                            |
+-------+---------------------------------------------------------------------------------------------------------+
| t     | CREATE TABLE `t` (
  `id` int(11) NOT NULL,
  PRIMARY KEY (`id`)
) ENGINE=TokuDB DEFAULT CHARSET=latin1 |
+-------+---------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
 
mysql> show table status;
+------+--------+---------+------------+------+----------------+-------------+---------------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
| Name | Engine | Version | Row_format | Rows | Avg_row_length | Data_length | Max_data_length     | Index_length | Data_free | Auto_increment | Create_time         | Update_time         | Check_time | Collation         | Checksum | Create_options | Comment |
+------+--------+---------+------------+------+----------------+-------------+---------------------+--------------+-----------+----------------+---------------------+---------------------+------------+-------------------+----------+----------------+---------+
| t    | TokuDB |      10 | Fixed      |    1 |              0 |           0 | 9223372036854775807 |            0 |     12288 |           NULL | 2014-03-24 16:36:21 | 2014-03-24 16:36:22 | NULL       | latin1_swedish_ci |     NULL

now, data/test/t.frm exists.



 Comments   
Comment by Sergei Golubchik [ 2014-03-26 ]

Here's the explanation (everything below applies only to engines that support discover):

  • In 10.0 .frm files are nothing more than the metadata cache, they do not define whether a table exists
  • .frm file isn't automatically created by the server — as the server cannot know whether an engine would want it or not
  • the first time the table is used — discovered — the engine can pass a write_frm=true flag to the server, if it wants table metadata to be cached in the .frm file
  • if no .frm file exists, the server relies on discover_table_names handlerton method to get the list of tables for SHOW TABLES, DROP DATABASE (MDEV-5839) and other statements
  • if the engine does not provide its own discover_table_names method, the server uses a default implementation that looks for files with declared extensions (bas_ext())
  • but tokudb doesn't store table files in the database directory, so the default discover_table_names doesn't work

as a fix, I force .frm to disk from ha_tokudb::create().

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