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

MDEV-33441 Do not deinit plugin variables when retry requested

After MDEV-31400, plugins are allowed to ask for retries when failing
initialisation. However, such failures also cause plugin system
variables to be deleted (plugin_variables_deinit()) before retrying
and are not re-added during retry.

We fix this by checking that if the plugin has requested a retry the
variables are not deleted. Because plugin_deinitialize() also calls
plugin_variables_deinit(), if the retry fails, the variables will
still be deleted.

Alternatives considered:

- remove the plugin_variables_deinit() from plugin_initialize() error
handling altogether. We decide to take a more conservative approach
here.

- re-add the system variables during retry. It is more complicated
than simply iterating over plugin->system_vars and call
my_hash_insert(). For example we will need to assign values to
the test_load field and extract more code from test_plugin_options(),
if that is possible.
This commit is contained in:
Yuchen Pei
2024-02-12 21:08:22 +11:00
committed by Oleksandr Byelkin
parent d21cb43db1
commit 068a6819eb
7 changed files with 42 additions and 1 deletions

View File

@ -1505,7 +1505,7 @@ static int plugin_initialize(MEM_ROOT *tmp_root, struct st_plugin_int *plugin,
else
ret= plugin_do_initialize(plugin, state);
if (ret)
if (ret && ret != HA_ERR_RETRY_INIT)
plugin_variables_deinit(plugin);
mysql_mutex_lock(&LOCK_plugin);
@ -1786,6 +1786,7 @@ int plugin_init(int *argc, char **argv, int flags)
uint state= plugin_ptr->state;
mysql_mutex_unlock(&LOCK_plugin);
error= plugin_do_initialize(plugin_ptr, state);
DBUG_EXECUTE_IF("fail_spider_init_retry", error= 1;);
mysql_mutex_lock(&LOCK_plugin);
plugin_ptr->state= state;
if (error == HA_ERR_RETRY_INIT)