1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-33538 make auxiliary spider plugins init depend on actual spider

The two I_S plugins SPIDER_ALLOC_MEM and SPIDER_WRAPPER_PROTOCOL
only makes sense if the main SPIDER plugin is installed. Further,
SPIDER_ALLOC_MEM requires a mutex that requires SPIDER init to fill
the table.

We also update the spider init query to override
--transaction_read_only=on so that it does not affect the spider init.

Also fixed error handling in spider_db_init() so that failure in
spider table init does not result in memory leak
This commit is contained in:
Yuchen Pei
2024-03-04 10:25:34 +11:00
parent 20f60fe70f
commit b84d335d9d
12 changed files with 66 additions and 13 deletions

View File

@ -9942,6 +9942,7 @@ ST_SCHEMA_TABLE schema_tables[]=
int initialize_schema_table(st_plugin_int *plugin)
{
ST_SCHEMA_TABLE *schema_table;
int err;
DBUG_ENTER("initialize_schema_table");
if (!(schema_table= (ST_SCHEMA_TABLE *)my_malloc(key_memory_ST_SCHEMA_TABLE,
@ -9958,12 +9959,15 @@ int initialize_schema_table(st_plugin_int *plugin)
/* Make the name available to the init() function. */
schema_table->table_name= plugin->name.str;
if (plugin->plugin->init(schema_table))
if ((err= plugin->plugin->init(schema_table)))
{
sql_print_error("Plugin '%s' init function returned error.",
plugin->name.str);
if (err != HA_ERR_RETRY_INIT)
sql_print_error("Plugin '%s' init function returned error.",
plugin->name.str);
plugin->data= NULL;
my_free(schema_table);
if (err == HA_ERR_RETRY_INIT)
DBUG_RETURN(err);
DBUG_RETURN(1);
}