burrito-brothers / shiba

Catch bad SQL queries before they cause problems in production
https://shiba-sql.com
Other
292 stars 14 forks source link

bin/mysql_dump_stats errors on tables without any indexes #19

Closed gabetax closed 5 years ago

gabetax commented 5 years ago

We have a handful of tables that don't have any indexes. Some use the BLACKHOLE storage engine. Another had its indexes removed in preparation for dropping it. Regardless, we get the following stack dump due to the disparity of SHOW TABLES and information_schema.statistics

$ bin/mysql_dump_stats ...
Traceback (most recent call last):
    8: from shiba/bin/dump_stats:22:in `<main>'
    7: from shiba/lib/shiba/fuzzer.rb:39:in `fetch_index'
    6: from shiba/lib/shiba/connection/mysql.rb:30:in `each_column_size'
    5: from shiba/lib/shiba/connection/mysql.rb:30:in `each'
    4: from shiba/lib/shiba/connection/mysql.rb:39:in `block in each_column_size'
    3: from shiba/lib/shiba/connection/mysql.rb:39:in `each'
    2: from shiba/lib/shiba/connection/mysql.rb:40:in `block (2 levels) in each_column_size'
    1: from shiba/lib/shiba/fuzzer.rb:40:in `block in fetch_index'
shiba/lib/shiba/index_stats.rb:169:in `set_column_size': couldn't find table: example_table_name (RuntimeError)
osheroff commented 5 years ago

fixed, won't crash here