diff --git a/mysql-test/main/mysqld_option_err.result b/mysql-test/main/mysqld_option_err.result index 157edb58532..85e78fa790d 100644 --- a/mysql-test/main/mysqld_option_err.result +++ b/mysql-test/main/mysqld_option_err.result @@ -14,6 +14,7 @@ FOUND 1 /option '--bootstrap' cannot take an argument/ in mysqltest.log FOUND 1 /Integer value out of range for uint64: '18446744073709551616' for binlog_cache_size/ in mysqltest.log FOUND 1 /Unknown suffix 'y' used for variable 'bulk_insert_buffer_size' \(value '123y'\). Legal suffix characters are: K, M, G, T, P, E/ in mysqltest.log FOUND 1 /Error while setting value '123y' to 'bulk_insert_buffer_size'/ in mysqltest.log +FOUND 1 /Error while setting value 'noexist' to 'plugin-example-enum-var'/ in mysqltest.log Test that --help --verbose works Test that --not-known-option --help --verbose gives error Done. diff --git a/mysql-test/main/mysqld_option_err.test b/mysql-test/main/mysqld_option_err.test index c2b943bafa1..dda0d7e4365 100644 --- a/mysql-test/main/mysqld_option_err.test +++ b/mysql-test/main/mysqld_option_err.test @@ -43,8 +43,8 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; # variable in mysqld command-line option. # See also Bug#32034. --echo Test that bad value for plugin enum option is rejected correctly. ---error 7 ---exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --plugin-dir=$MYSQLTEST_VARDIR/plugins --plugin-load=example=ha_example.so --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 +--error 1 +--exec $MYSQLD_BOOTSTRAP_CMD --skip-networking --datadir=$MYSQLTEST_VARDIR/tmp/mysqld_option_err --skip-grant-tables --plugin-maturity=experimental --plugin-load=example=ha_example --plugin-example=FORCE --plugin-example-enum-var=noexist >>$MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log 2>&1 --let SEARCH_FILE = $MYSQLTEST_VARDIR/tmp/mysqld_option_err/mysqltest.log @@ -75,6 +75,9 @@ mkdir $MYSQLTEST_VARDIR/tmp/mysqld_option_err; --source include/search_pattern_in_file.inc --let SEARCH_PATTERN=Error while setting value '123y' to 'bulk_insert_buffer_size' --source include/search_pattern_in_file.inc +--let SEARCH_PATTERN=Error while setting value 'noexist' to 'plugin-example-enum-var' +--source include/search_pattern_in_file.inc + # # Test that an wrong option with --help --verbose gives an error diff --git a/sql/sql_plugin.cc b/sql/sql_plugin.cc index 03f89c3de9f..a5ffabc4a37 100644 --- a/sql/sql_plugin.cc +++ b/sql/sql_plugin.cc @@ -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 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 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; /*