mirror of
https://github.com/MariaDB/server.git
synced 2026-10-23 18:49:29 +03:00
fix main.mysqld_option_err test that didn't work for years
the "Test that bad value for plugin enum option is rejected correctly" needed multiple fixes: 1. don't set plugin-dir based on $MYSQLTEST_VARDIR, all plugins are in var/plugins, but $MYSQLTEST_VARDIR is var/1/, var/2/, etc if --parallel is used (that is, practically always), thus the ha_example.so cannot be loaded, because cannot be found. Test fails with "unknown option --plugin-example-enum" as the plugin is not loaded 2. force --plugin-maturity=experimental, otherwise even if not parallel the plugin will fail to load because of low maturity, test still fails with "unknown option --plugin-example-enum" 3. don't specify .so extension explicitly otherwise the plugin still doesn't load on windows, even if paths and maturity are fixed 4. set --plugin-example=FORCE otherwise plugin fails to load after reading --plugin-example-enum-var=noexist because of unknown enum value, the server ignores the failure and starts normally. the test hangs. 5. This needs the fix in sql_plugin.cc to detect that the plugin is forced even when some options failed to parse. It used to consider plugin forced only if all options parsed correctly, which was wrong. Now the test passes, testing what it was supposed to test - failure to parse an enum value of a plugin option. Without these fixes the test hanged as in 4 when run on the main branch in non-prarallel (e.g. one test only) mode.
This commit is contained in:
@@ -4178,7 +4178,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
|
||||
int *argc, char **argv)
|
||||
{
|
||||
struct sys_var_chain chain= { NULL, NULL };
|
||||
bool disable_plugin;
|
||||
bool disable_plugin= false;
|
||||
enum_plugin_load_option plugin_load_option= tmp->load_option;
|
||||
|
||||
MEM_ROOT *mem_root= alloc_root_inited(&tmp->mem_root) ?
|
||||
@@ -4286,23 +4286,25 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
|
||||
error= handle_options(argc, &argv, opts, mark_changed);
|
||||
(*argc)++; /* add back one for the program name */
|
||||
|
||||
/*
|
||||
Set plugin loading policy from option value. First element in the option
|
||||
list is always the <plugin name> option value.
|
||||
*/
|
||||
if (!plugin_is_forced(tmp))
|
||||
{
|
||||
plugin_load_option= (enum_plugin_load_option) *(ulong*) opts[0].value;
|
||||
disable_plugin= (plugin_load_option == PLUGIN_OFF);
|
||||
tmp->load_option= plugin_load_option;
|
||||
}
|
||||
|
||||
if (unlikely(error))
|
||||
{
|
||||
sql_print_error("Parsing options for plugin '%s' failed. Disabling plugin",
|
||||
tmp->name.str);
|
||||
goto err;
|
||||
}
|
||||
/*
|
||||
Set plugin loading policy from option value. First element in the option
|
||||
list is always the <plugin name> option value.
|
||||
*/
|
||||
if (!plugin_is_forced(tmp))
|
||||
plugin_load_option= (enum_plugin_load_option) *(ulong*) opts[0].value;
|
||||
}
|
||||
|
||||
disable_plugin= (plugin_load_option == PLUGIN_OFF);
|
||||
tmp->load_option= plugin_load_option;
|
||||
|
||||
error= 1;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user