Check for entries with "Unknown storage engine" in I_S.TABLES,
try to load plugins for these tables if available (MDEV-11942)
*/
staticintrun_mysqlcheck_engines(void)
{
DYNAMIC_STRINGds_query;
DYNAMIC_STRINGds_result;
/* Trying to identify existing tables with unknown storage engine
Does not work with all engine types yet, and doesn't produce
results for BLACKHOLE without the dummy "WHERE row_format IS NULL"
condition yet. See MDEV-11943 */
constchar*query="SELECT DISTINCT LOWER(REPLACE(REPLACE(table_comment, 'Unknown storage engine ', ''), '\\'', '')) AS engine FROM information_schema.tables WHERE row_format IS NULL AND table_comment LIKE 'Unknown storage engine%'";
if(init_dynamic_string(&ds_query,"",512,512))
die("Out of memory");
if(init_dynamic_string(&ds_result,"",512,512))
die("Out of memory");
verbose("Checking for tables with unknown storage engine");
run_query(query,&ds_result,TRUE);
{
char*line=ds_result.str;
if(line&&*line){
do
{
line[strlen(line)-1]='\0';
verbose("installing missing plugin for '%s' storage engine",line);
dynstr_set(&ds_query,"INSTALL SONAME 'ha_");
dynstr_append(&ds_query,line);// we simply assume SONAME=ha_ENGINENAME