Details
-
Type:
Bug
-
Status: Closed
-
Priority:
Major
-
Resolution: Won't Fix
-
Affects Version/s: 10.1.0
-
Fix Version/s: N/A
-
Component/s: Admin statements
-
Labels:None
-
Environment:all
Description
I have added support for SHOW TABLES discovery to the ScaleDB interface 'discover_table_names'
(ie show tables will now call into scaledb to get a list of tables in the database).
However, there seems to be a problem in mariadb.
The file based discovery is still getting called.
handler.cpp:5137
...
error= extension_based_table_discovery(dirp, reg_ext, result) ||
plugin_foreach(thd, discover_names,
MYSQL_STORAGE_ENGINE_PLUGIN, &args);
result->sort();
...
SHOW TABLES looks at both the directory contents (ie. the FRM files) as well as calling into ScaleDB to get the list, and then returns a list (excluding duplicates). In most cases this works fine (but not in a clustered environment like ScaleDB),
If the FRM is present, but the table does not exist in SCALEDB, then SHOW TABLES will report that the table still exists which is wrong.
This can occur in the following case,
1) i create table T on node 1, an FRM file is created on node 1:
2) on node 2 i drop table T.
The table now won't exists in scaledb anymore but there is still an FRM on node 1. So if I run SHOW TABLES against node 1 it will return table T.
fix: need to remove the file based discovery if discover_table_names is supported.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
This behavior is, basically, an optimization. SHOW TABLES doesn't read the .frm file and doesn't call into the engine if the .frm file exists. Indeed, if there is t1.frm but scaledb's discover_names() does not return "t1" table - it doesn't mean much, perhaps t1 is a MyISAM table (or even a blackhole table - doesn't support discovery and doesn't have any files besides .frm). So we need to read the .frm file to know the table type.
If you do SHOW FULL TABLES — this command shows the object type (VIEW or TABLE), to do that it has to read the .frm file, and then it also verifies whether the table actually exists in the engine.
But a simple SHOW TABLES it's supposed to be as fast as possible, and as a trade-off, sometimes it can return tables that were dropped on the other node.