mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
MDEV-3860 backport --plugin-load-add (and related mysql-test changes)
revno: 3383 revision-id: georgi.kodinov@oracle.com-20110818083108-qa3h3ufqu4zne80a committer: Georgi Kodinov <Georgi.Kodinov@Oracle.com> timestamp: Thu 2011-08-18 11:31:08 +0300 message: Bug #11766001: 59026: ALLOW MULTIPLE --PLUGIN-LOAD OPTIONS Implemented support for a new command line option : --plugin-load-add=<comma-separated-name-equals-value-list> This option takes the same type of arguments that --plugin-load does and complements --plugin-load (that continues to operate as before) by appending its argument to the list specified by --plugin-load. So --plugin-load can be considered a composite option consisting of resetting the plugin load list and then calling --plugin-load-add to process the argument. Note that the order in which you specify --plugin-load and --plugin-load-add is important : "--plugin-load=x --plugin-load-add=y" will be equivalent to "--plugin-load=x,y" whereas "--plugin-load-add=y --plugin-load=x" will be equivalent to "plugin-load=x". Incompatible change : the --help --verbose command will no longer print the --plugin-load variable's values (as it doesn't have one). Otherwise both --plugin-load and --plugin-load-add are mentioned in it.
This commit is contained in:
@ -1,2 +1,2 @@
|
|||||||
--loose-archive
|
--loose-archive
|
||||||
--plugin-load=$HA_ARCHIVE_SO
|
--plugin-load-add=$HA_ARCHIVE_SO
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
--loose-blackhole
|
--loose-blackhole
|
||||||
--plugin-load=$HA_BLACKHOLE_SO
|
--plugin-load-add=$HA_BLACKHOLE_SO
|
||||||
|
@ -1,13 +1,13 @@
|
|||||||
[innodb_plugin]
|
[innodb_plugin]
|
||||||
ignore-builtin-innodb
|
ignore-builtin-innodb
|
||||||
plugin-load=$HA_INNODB_SO
|
plugin-load-add=$HA_INNODB_SO
|
||||||
innodb
|
innodb
|
||||||
innodb-cmpmem
|
innodb-cmpmem
|
||||||
innodb-trx
|
innodb-trx
|
||||||
|
|
||||||
[xtradb_plugin]
|
[xtradb_plugin]
|
||||||
ignore-builtin-innodb
|
ignore-builtin-innodb
|
||||||
plugin-load=$HA_XTRADB_SO
|
plugin-load-add=$HA_XTRADB_SO
|
||||||
innodb
|
innodb
|
||||||
innodb-cmpmem
|
innodb-cmpmem
|
||||||
innodb-trx
|
innodb-trx
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load=$AUTH_TEST_PLUGIN_SO
|
--plugin-load-add=$AUTH_TEST_PLUGIN_SO
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[xtradb_plugin]
|
[xtradb_plugin]
|
||||||
ignore-builtin-innodb
|
ignore-builtin-innodb
|
||||||
plugin-load=$HA_XTRADB_SO
|
plugin-load-add=$HA_XTRADB_SO
|
||||||
innodb
|
innodb
|
||||||
innodb-cmpmem
|
innodb-cmpmem
|
||||||
innodb-trx
|
innodb-trx
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
# PLUGVAR_DIR: name of directory where plugin was found
|
# PLUGVAR_DIR: name of directory where plugin was found
|
||||||
# PLUGVAR_OPT: mysqld option --plugin_dir=....
|
# PLUGVAR_OPT: mysqld option --plugin_dir=....
|
||||||
# PLUGVAR_LOAD: option --plugin_load=.... if the 4th element is present
|
# PLUGVAR_LOAD: option --plugin_load=.... if the 4th element is present
|
||||||
|
# PLUGVAR_LOAD_ADD: option --plugin_load_add=.... if the 4th element is present
|
||||||
#
|
#
|
||||||
# If a listed plugin is not found, the corresponding variables will be
|
# If a listed plugin is not found, the corresponding variables will be
|
||||||
# set to empty, they will not be unset.
|
# set to empty, they will not be unset.
|
||||||
|
@ -5264,9 +5264,6 @@ sub mysqld_arguments ($$$) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
my $found_skip_core= 0;
|
my $found_skip_core= 0;
|
||||||
my @plugins;
|
|
||||||
my %seen;
|
|
||||||
my $plugin;
|
|
||||||
foreach my $arg ( @$extra_opts )
|
foreach my $arg ( @$extra_opts )
|
||||||
{
|
{
|
||||||
# Skip --defaults-file option since it's handled above.
|
# Skip --defaults-file option since it's handled above.
|
||||||
@ -5286,12 +5283,6 @@ sub mysqld_arguments ($$$) {
|
|||||||
{
|
{
|
||||||
; # Dont add --skip-log-bin when mysqld have --log-slave-updates in config
|
; # Dont add --skip-log-bin when mysqld have --log-slave-updates in config
|
||||||
}
|
}
|
||||||
elsif ($plugin = mtr_match_prefix($arg, "--plugin-load="))
|
|
||||||
{
|
|
||||||
next if $plugin =~ /=$/;
|
|
||||||
push @plugins, $plugin unless $seen{$plugin};
|
|
||||||
$seen{$plugin} = 1;
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mtr_add_arg($args, "%s", $arg);
|
mtr_add_arg($args, "%s", $arg);
|
||||||
@ -5308,11 +5299,6 @@ sub mysqld_arguments ($$$) {
|
|||||||
mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
|
mtr_add_arg($args, "--loose-debug-sync-timeout=%s",
|
||||||
$opt_debug_sync_timeout) unless $opt_user_args;
|
$opt_debug_sync_timeout) unless $opt_user_args;
|
||||||
|
|
||||||
if (@plugins) {
|
|
||||||
my $sep = (IS_WINDOWS) ? ';' : ':';
|
|
||||||
mtr_add_arg($args, "--plugin-load=%s" . join($sep, @plugins));
|
|
||||||
}
|
|
||||||
|
|
||||||
return $args;
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,6 +606,11 @@ The following options may be given as the first argument:
|
|||||||
plugin is specified as ether a plugin_name=library_file
|
plugin is specified as ether a plugin_name=library_file
|
||||||
pair or only a library_file. If the latter case, all
|
pair or only a library_file. If the latter case, all
|
||||||
plugins from a given library_file will be loaded.
|
plugins from a given library_file will be loaded.
|
||||||
|
--plugin-load-add=name
|
||||||
|
Optional semicolon-separated list of plugins to load.
|
||||||
|
This option adds to the list speficied by --plugin-load
|
||||||
|
in an incremental way. It can be specified many times,
|
||||||
|
adding more plugins every time.
|
||||||
--plugin-maturity=name
|
--plugin-maturity=name
|
||||||
The lowest desirable plugin maturity (unknown,
|
The lowest desirable plugin maturity (unknown,
|
||||||
experimental, alpha, beta, gamma, or stable). Plugins
|
experimental, alpha, beta, gamma, or stable). Plugins
|
||||||
@ -1115,7 +1120,6 @@ performance-schema-max-thread-instances 1000
|
|||||||
performance-schema-setup-actors-size 100
|
performance-schema-setup-actors-size 100
|
||||||
performance-schema-setup-objects-size 100
|
performance-schema-setup-objects-size 100
|
||||||
performance-schema-users-size 100
|
performance-schema-users-size 100
|
||||||
plugin-load (No default value)
|
|
||||||
plugin-maturity unknown
|
plugin-maturity unknown
|
||||||
port 3306
|
port 3306
|
||||||
port-open-timeout 0
|
port-open-timeout 0
|
||||||
|
@ -1,3 +1,10 @@
|
|||||||
SELECT @@global.example_enum_var = 'e2';
|
SELECT @@global.example_enum_var = 'e2';
|
||||||
@@global.example_enum_var = 'e2'
|
@@global.example_enum_var = 'e2'
|
||||||
1
|
1
|
||||||
|
select plugin_name, plugin_status from information_schema.plugins
|
||||||
|
where plugin_name in ('SIMPLE_PARSER', 'EXAMPLE',
|
||||||
|
'DAEMON_EXAMPLE', 'TWO_QUESTIONS', 'THREE_ATTEMPTS');
|
||||||
|
plugin_name plugin_status
|
||||||
|
EXAMPLE ACTIVE
|
||||||
|
daemon_example ACTIVE
|
||||||
|
simple_parser ACTIVE
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[old]
|
[old]
|
||||||
plugin-load=$HA_FEDERATED_SO
|
plugin-load-add=$HA_FEDERATED_SO
|
||||||
|
|
||||||
[X]
|
[X]
|
||||||
plugin-load=$HA_FEDERATEDX_SO
|
plugin-load-add=$HA_FEDERATEDX_SO
|
||||||
|
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load=$HA_FEDERATEDX_SO --federated
|
--plugin-load-add=$HA_FEDERATEDX_SO --federated
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
--loose-federated
|
--loose-federated
|
||||||
--plugin-load=$HA_FEDERATEDX_SO
|
--plugin-load-add=$HA_FEDERATEDX_SO
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load=$HA_OQGRAPH_SO --enable-oqgraph
|
--plugin-load-add=$HA_OQGRAPH_SO --enable-oqgraph
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
--loose-feedback
|
--loose-feedback
|
||||||
--plugin-load=$FEEDBACK_SO
|
--plugin-load-add=$FEEDBACK_SO
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load=$HA_SPHINX_SO --sphinx
|
--plugin-load-add=$HA_SPHINX_SO --sphinx
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load=$QA_AUTH_INTERFACE_SO
|
--plugin-load-add=$QA_AUTH_INTERFACE_SO
|
||||||
|
@ -1 +1 @@
|
|||||||
--plugin-load=$QA_AUTH_SERVER_SO
|
--plugin-load-add=$QA_AUTH_SERVER_SO
|
||||||
|
@ -1,2 +0,0 @@
|
|||||||
--plugin-load=EXAMPLE=$HA_EXAMPLE_SO
|
|
||||||
--loose-plugin-example-enum-var=e2
|
|
6
mysql-test/t/plugin_load.opt
Normal file
6
mysql-test/t/plugin_load.opt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
--plugin-load-add=$DIALOG_EXAMPLES_SO
|
||||||
|
--plugin-load=$LIBDAEMON_EXAMPLE_SO
|
||||||
|
--plugin-load-add=EXAMPLE=$HA_EXAMPLE_SO
|
||||||
|
--plugin-load-add=$MYPLUGLIB_SO
|
||||||
|
--plugin-load-add=$HA_EXAMPLE_SO
|
||||||
|
--loose-plugin-example-enum-var=e2
|
@ -1,4 +1,18 @@
|
|||||||
--source include/not_windows_embedded.inc
|
--source include/not_windows_embedded.inc
|
||||||
--source include/have_example_plugin.inc
|
--source include/have_example_plugin.inc
|
||||||
|
|
||||||
|
if (!$MYPLUGLIB_SO) {
|
||||||
|
--echo needs SIMPLE_PARSER plugin
|
||||||
|
}
|
||||||
|
if (!$LIBDAEMON_EXAMPLE_SO) {
|
||||||
|
--echo needs DAEMON_EXAMPLE plugin
|
||||||
|
}
|
||||||
|
if (!$DIALOG_EXAMPLES_SO) {
|
||||||
|
--echo needs dialog examples plugins
|
||||||
|
}
|
||||||
SELECT @@global.example_enum_var = 'e2';
|
SELECT @@global.example_enum_var = 'e2';
|
||||||
|
|
||||||
|
--sorted_result
|
||||||
|
select plugin_name, plugin_status from information_schema.plugins
|
||||||
|
where plugin_name in ('SIMPLE_PARSER', 'EXAMPLE',
|
||||||
|
'DAEMON_EXAMPLE', 'TWO_QUESTIONS', 'THREE_ATTEMPTS');
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
--plugin-load=EXAMPLE=$HA_EXAMPLE_SO
|
--plugin-load-add=EXAMPLE=$HA_EXAMPLE_SO
|
||||||
--loose-plugin-example=FORCE_PLUS_PERMANENT
|
--loose-plugin-example=FORCE_PLUS_PERMANENT
|
||||||
|
@ -1908,6 +1908,7 @@ void clean_up(bool print_message)
|
|||||||
mysql_cond_broadcast(&COND_thread_count);
|
mysql_cond_broadcast(&COND_thread_count);
|
||||||
mysql_mutex_unlock(&LOCK_thread_count);
|
mysql_mutex_unlock(&LOCK_thread_count);
|
||||||
|
|
||||||
|
free_list(opt_plugin_load_list_ptr);
|
||||||
/*
|
/*
|
||||||
The following lines may never be executed as the main thread may have
|
The following lines may never be executed as the main thread may have
|
||||||
killed us
|
killed us
|
||||||
@ -6626,11 +6627,17 @@ struct my_option my_long_options[]=
|
|||||||
&opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
&opt_verbose, &opt_verbose, 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
|
{"version", 'V', "Output version information and exit.", 0, 0, 0, GET_NO_ARG,
|
||||||
NO_ARG, 0, 0, 0, 0, 0, 0},
|
NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"plugin-load", 0,
|
{"plugin-load", OPT_PLUGIN_LOAD,
|
||||||
"Semicolon-separated list of plugins to load, where each plugin is "
|
"Semicolon-separated list of plugins to load, where each plugin is "
|
||||||
"specified as ether a plugin_name=library_file pair or only a library_file. "
|
"specified as ether a plugin_name=library_file pair or only a library_file. "
|
||||||
"If the latter case, all plugins from a given library_file will be loaded.",
|
"If the latter case, all plugins from a given library_file will be loaded.",
|
||||||
&opt_plugin_load, &opt_plugin_load, 0,
|
0, 0, 0,
|
||||||
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
|
{"plugin-load-add", OPT_PLUGIN_LOAD_ADD,
|
||||||
|
"Optional semicolon-separated list of plugins to load. This option adds "
|
||||||
|
"to the list speficied by --plugin-load in an incremental way. "
|
||||||
|
"It can be specified many times, adding more plugins every time.",
|
||||||
|
0, 0, 0,
|
||||||
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||||
{"table_cache", 0, "Deprecated; use --table-open-cache instead.",
|
{"table_cache", 0, "Deprecated; use --table-open-cache instead.",
|
||||||
&table_cache_size, &table_cache_size, 0, GET_ULONG,
|
&table_cache_size, &table_cache_size, 0, GET_ULONG,
|
||||||
@ -7989,6 +7996,13 @@ mysqld_get_one_option(int optid,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case OPT_PLUGIN_LOAD:
|
||||||
|
free_list(opt_plugin_load_list_ptr);
|
||||||
|
/* fall through */
|
||||||
|
case OPT_PLUGIN_LOAD_ADD:
|
||||||
|
opt_plugin_load_list_ptr->push_back(new i_string(argument));
|
||||||
|
break;
|
||||||
case OPT_MAX_LONG_DATA_SIZE:
|
case OPT_MAX_LONG_DATA_SIZE:
|
||||||
max_long_data_size_used= true;
|
max_long_data_size_used= true;
|
||||||
break;
|
break;
|
||||||
|
@ -514,6 +514,8 @@ enum options_mysqld
|
|||||||
OPT_LOG_ERROR,
|
OPT_LOG_ERROR,
|
||||||
OPT_LOWER_CASE_TABLE_NAMES,
|
OPT_LOWER_CASE_TABLE_NAMES,
|
||||||
OPT_MAX_LONG_DATA_SIZE,
|
OPT_MAX_LONG_DATA_SIZE,
|
||||||
|
OPT_PLUGIN_LOAD,
|
||||||
|
OPT_PLUGIN_LOAD_ADD,
|
||||||
OPT_ONE_THREAD,
|
OPT_ONE_THREAD,
|
||||||
OPT_PFS_INSTRUMENT,
|
OPT_PFS_INSTRUMENT,
|
||||||
OPT_POOL_OF_THREADS,
|
OPT_POOL_OF_THREADS,
|
||||||
|
@ -51,8 +51,8 @@ static TYPELIB global_plugin_typelib=
|
|||||||
{ array_elements(global_plugin_typelib_names)-1,
|
{ array_elements(global_plugin_typelib_names)-1,
|
||||||
"", global_plugin_typelib_names, NULL };
|
"", global_plugin_typelib_names, NULL };
|
||||||
|
|
||||||
|
static I_List<i_string> opt_plugin_load_list;
|
||||||
char *opt_plugin_load= NULL;
|
I_List<i_string> *opt_plugin_load_list_ptr= &opt_plugin_load_list;
|
||||||
char *opt_plugin_dir_ptr;
|
char *opt_plugin_dir_ptr;
|
||||||
char opt_plugin_dir[FN_REFLEN];
|
char opt_plugin_dir[FN_REFLEN];
|
||||||
ulong plugin_maturity;
|
ulong plugin_maturity;
|
||||||
@ -1040,7 +1040,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
|
|||||||
{
|
{
|
||||||
struct st_plugin_int tmp;
|
struct st_plugin_int tmp;
|
||||||
struct st_maria_plugin *plugin;
|
struct st_maria_plugin *plugin;
|
||||||
uint oks= 0, errs= 0;
|
uint oks= 0, errs= 0, dupes= 0;
|
||||||
DBUG_ENTER("plugin_add");
|
DBUG_ENTER("plugin_add");
|
||||||
DBUG_PRINT("enter", ("name: %s dl: %s", name->str, dl->str));
|
DBUG_PRINT("enter", ("name: %s dl: %s", name->str, dl->str));
|
||||||
|
|
||||||
@ -1069,7 +1069,10 @@ static bool plugin_add(MEM_ROOT *tmp_root,
|
|||||||
continue; // plugin name doesn't match
|
continue; // plugin name doesn't match
|
||||||
|
|
||||||
if (!name->str && plugin_find_internal(&tmp.name, MYSQL_ANY_PLUGIN))
|
if (!name->str && plugin_find_internal(&tmp.name, MYSQL_ANY_PLUGIN))
|
||||||
|
{
|
||||||
|
dupes++;
|
||||||
continue; // already installed
|
continue; // already installed
|
||||||
|
}
|
||||||
|
|
||||||
struct st_plugin_int *tmp_plugin_ptr;
|
struct st_plugin_int *tmp_plugin_ptr;
|
||||||
if (*(int*)plugin->info <
|
if (*(int*)plugin->info <
|
||||||
@ -1128,11 +1131,13 @@ err:
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (errs == 0 && oks == 0) // no plugin was found
|
DBUG_ASSERT(!name->str || !dupes); // dupes is ONLY for name->str == 0
|
||||||
|
|
||||||
|
if (errs == 0 && oks == 0 && !dupes) // no plugin was found
|
||||||
report_error(report, ER_CANT_FIND_DL_ENTRY, name->str);
|
report_error(report, ER_CANT_FIND_DL_ENTRY, name->str);
|
||||||
|
|
||||||
plugin_dl_del(dl);
|
plugin_dl_del(dl);
|
||||||
DBUG_RETURN(errs > 0 || oks == 0);
|
DBUG_RETURN(errs > 0 || oks + dupes == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1625,8 +1630,11 @@ int plugin_init(int *argc, char **argv, int flags)
|
|||||||
/* Register all dynamic plugins */
|
/* Register all dynamic plugins */
|
||||||
if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
|
if (!(flags & PLUGIN_INIT_SKIP_DYNAMIC_LOADING))
|
||||||
{
|
{
|
||||||
if (opt_plugin_load)
|
I_List_iterator<i_string> iter(opt_plugin_load_list);
|
||||||
plugin_load_list(&tmp_root, argc, argv, opt_plugin_load);
|
i_string *item;
|
||||||
|
while (NULL != (item= iter++))
|
||||||
|
plugin_load_list(&tmp_root, argc, argv, item->ptr);
|
||||||
|
|
||||||
if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE))
|
if (!(flags & PLUGIN_INIT_SKIP_PLUGIN_TABLE))
|
||||||
plugin_load(&tmp_root, argc, argv);
|
plugin_load(&tmp_root, argc, argv);
|
||||||
}
|
}
|
||||||
|
@ -40,6 +40,7 @@ enum enum_plugin_load_option { PLUGIN_OFF, PLUGIN_ON, PLUGIN_FORCE,
|
|||||||
extern const char *global_plugin_typelib_names[];
|
extern const char *global_plugin_typelib_names[];
|
||||||
|
|
||||||
#include <my_sys.h>
|
#include <my_sys.h>
|
||||||
|
#include "sql_list.h"
|
||||||
|
|
||||||
#ifdef DBUG_OFF
|
#ifdef DBUG_OFF
|
||||||
#define plugin_ref_to_int(A) A
|
#define plugin_ref_to_int(A) A
|
||||||
@ -137,7 +138,7 @@ typedef struct st_plugin_int **plugin_ref;
|
|||||||
|
|
||||||
typedef int (*plugin_type_init)(struct st_plugin_int *);
|
typedef int (*plugin_type_init)(struct st_plugin_int *);
|
||||||
|
|
||||||
extern char *opt_plugin_load;
|
extern I_List<i_string> *opt_plugin_load_list_ptr;
|
||||||
extern char *opt_plugin_dir_ptr;
|
extern char *opt_plugin_dir_ptr;
|
||||||
extern char opt_plugin_dir[FN_REFLEN];
|
extern char opt_plugin_dir[FN_REFLEN];
|
||||||
extern const LEX_STRING plugin_type_names[];
|
extern const LEX_STRING plugin_type_names[];
|
||||||
|
Reference in New Issue
Block a user