[MDEV-11943] I_S.TABLES inconsistencies with tables with unknown storage engine Created: 2017-01-30 Updated: 2017-03-10 Resolved: 2017-03-10 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Admin statements, Server |
| Affects Version/s: | 10.1.21 |
| Fix Version/s: | 10.1.22, 10.2.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Hartmut Holzgraefe | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
linux |
||
| Issue Links: |
|
||||||||
| Sprint: | 10.1.22 | ||||||||
| Description |
|
When having tables with unknown storage engine, e.g. due to a missing plugin, information for such tables is only read from INFORMATION_SCHEMA.TABLES on SELECT * FROM TABLES ...", not when trying to get the count of tables with SELECT COUNT(*) or when trying to read specific tables only. (found while trying to come up with a fix for How to reproduce:
Now we have a table with unknown engine.
SELECT * found the table entry just fine and correctly reported the engine as unknown. Now lets try to only read specific columns instead of '*'
The table is no longer found, but COUNT(*) works here:
Now instead of searching by schema lets search by table comment instead:
This worked, but asking for specific columns again doesn't:
And now COUNT(*) doesn't work anymore either:
Expected result: changes in the filed list, but not on the WHERE condition, should not change the query results |
| Comments |
| Comment by Elena Stepanova [ 2017-02-01 ] | |||||||||||||||||
|
Inconsistencies are reproducible easily, except for this one:
It's not "anymore", this particular COUNT didn't work before. The one that worked was different:
(and it still works). | |||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2017-02-02 ] | |||||||||||||||||
|
That's what I meant, after changing the WHERE condition COUNT | |||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2017-02-03 ] | |||||||||||||||||
|
Tracked it down a little more, results change depending on actual columns being queries,
| |||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2017-02-07 ] | |||||||||||||||||
|
If any of these columns is used in the query, either as result field or as part of the WHERE condition, the result correctly includes tables for which the engine plugin is not loaded (implicit use by SELECT * also counts):
If only these columns are used these tables are somehow ignored:
| |||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2017-02-07 ] | |||||||||||||||||
|
More 'fun': when uninstalling the ARCHIVE engine plugin the ARCHIVE tables are not listed in I_S.TABLES at all, no matter what columns are used. So my "check INFORMATION_SCHEMA for tables with unknown engines, then issue appropriate INSTALL SONAME commands for these" plan for | |||||||||||||||||
| Comment by Hartmut Holzgraefe [ 2017-02-15 ] | |||||||||||||||||
|
For BLACKHOLE I understand things a tiny little bit better now: BLACKHOLE tables will only appear in I_S.TABLES result when the plugin isn't loaded if one of the I_S.TABLES columns marked with open_table=OPEN_FULL_TABLE in ST_FIELD_INFO tables_fields_info[] in sql/sql_show.cc is touched by the query, either in the WHERE condition or the result field list Why I_S.TABLES behaves differently on ARCHIVE than on BLACKHOLE when both plugins are not loaded is still a mystery to me though ... | |||||||||||||||||
| Comment by Sergei Golubchik [ 2017-03-03 ] | |||||||||||||||||
|
I've now fixed the inconsistent behavior, that dependent on what columns were selected. Almost, if you only select the table name, the table isn't opened, so it's engine isn't known, no warning. If the table is opened, though, and the engine is not loaded, there will be a warning. |