Spider cannot run DDL (e.g. create tables) before ddl recovery

use signal_ddl_recovery_done callback for that.

also make the server to call signal_ddl_recovery_done() when loading
plugins at run-time (so that plugins would't need to detect that
on their own)
This commit is contained in:
Sergei Golubchik 2023-12-15 19:58:31 +01:00
parent e95bba9c58
commit 0930eb86cb
2 changed files with 15 additions and 7 deletions

View file

@ -629,7 +629,7 @@ int ha_finalize_handlerton(st_plugin_int *plugin)
const char *hton_no_exts[]= { 0 };
static bool ddl_recovery_done= false;
int ha_initialize_handlerton(st_plugin_int *plugin)
{
@ -779,6 +779,9 @@ int ha_initialize_handlerton(st_plugin_int *plugin)
resolve_sysvar_table_options(hton);
update_discovery_counters(hton, 1);
if (ddl_recovery_done && hton->signal_ddl_recovery_done)
hton->signal_ddl_recovery_done(hton);
DBUG_RETURN(ret);
err_deinit:
@ -975,6 +978,7 @@ void ha_signal_ddl_recovery_done()
DBUG_ENTER("ha_signal_ddl_recovery_done");
plugin_foreach(NULL, signal_ddl_recovery_done, MYSQL_STORAGE_ENGINE_PLUGIN,
NULL);
ddl_recovery_done= true;
DBUG_VOID_RETURN;
}

View file

@ -7123,6 +7123,15 @@ bool spider_init_system_tables()
}
/*
Spider is typically loaded before ddl_recovery, but DDL statements
cannot be executed before ddl_recovery, so we delay system table creation.
*/
static void spider_after_ddl_recovery(handlerton *)
{
spider_init_system_tables();
}
int spider_db_init(
void *p
) {
@ -7153,6 +7162,7 @@ int spider_db_init(
spider_hton->close_cursor_read_view = spider_close_cursor_read_view;
*/
spider_hton->panic = spider_panic;
spider_hton->signal_ddl_recovery_done= spider_after_ddl_recovery;
spider_hton->close_connection = spider_close_connection;
spider_hton->start_consistent_snapshot = spider_start_consistent_snapshot;
spider_hton->flush_logs = spider_flush_logs;
@ -7490,11 +7500,6 @@ int spider_db_init(
spider_udf_table_mon_list_hash[roop_count].array.size_of_element);
}
if (spider_init_system_tables())
{
goto error_system_table_creation;
}
#ifndef WITHOUT_SPIDER_BG_SEARCH
if (!(spider_table_sts_threads = (SPIDER_THREAD *)
spider_bulk_malloc(NULL, SPD_MID_DB_INIT_12, MYF(MY_WME | MY_ZEROFILL),
@ -7595,7 +7600,6 @@ error_init_udf_table_mon_list_hash:
error_init_udf_table_mon_cond:
for (; roop_count >= 0; roop_count--)
pthread_cond_destroy(&spider_udf_table_mon_conds[roop_count]);
error_system_table_creation:
roop_count = spider_param_udf_table_mon_mutex_count() - 1;
error_init_udf_table_mon_mutex:
for (; roop_count >= 0; roop_count--)