Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
85d023eb
Commit
85d023eb
authored
Oct 07, 2010
by
Sergey Vojtovich
Browse files
Options
Browse Files
Download
Plain Diff
Merge WL#5496 and WL#5341 to 5.5-bugteam.
parents
f6e649cf
d9aa8215
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
59 additions
and
16 deletions
+59
-16
mysql-test/r/plugin_load_option.result
mysql-test/r/plugin_load_option.result
+7
-0
mysql-test/suite/funcs_1/r/is_columns_is.result
mysql-test/suite/funcs_1/r/is_columns_is.result
+2
-0
mysql-test/t/plugin_load_option-master.opt
mysql-test/t/plugin_load_option-master.opt
+3
-0
mysql-test/t/plugin_load_option.test
mysql-test/t/plugin_load_option.test
+8
-0
sql/share/errmsg-utf8.txt
sql/share/errmsg-utf8.txt
+3
-0
sql/sql_plugin.cc
sql/sql_plugin.cc
+24
-15
sql/sql_plugin.h
sql/sql_plugin.h
+6
-1
sql/sql_show.cc
sql/sql_show.cc
+6
-0
No files found.
mysql-test/r/plugin_load_option.result
0 → 100644
View file @
85d023eb
UNINSTALL PLUGIN example;
ERROR HY000: Plugin 'example' is force_plus_permanent and can not be unloaded
SELECT PLUGIN_NAME, PLUGIN_STATUS, LOAD_OPTION FROM INFORMATION_SCHEMA.PLUGINS
WHERE PLUGIN_NAME IN ('MyISAM', 'EXAMPLE');
PLUGIN_NAME PLUGIN_STATUS LOAD_OPTION
MyISAM ACTIVE FORCE
EXAMPLE ACTIVE FORCE_PLUS_PERMANENT
mysql-test/suite/funcs_1/r/is_columns_is.result
View file @
85d023eb
...
...
@@ -165,6 +165,7 @@ def information_schema PARTITIONS TABLE_NAME 3 NO varchar 64 192 NULL NULL utf8
def information_schema PARTITIONS TABLE_ROWS 13 0 NO bigint NULL NULL 20 0 NULL NULL bigint(21) unsigned select
def information_schema PARTITIONS TABLE_SCHEMA 2 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PARTITIONS UPDATE_TIME 20 NULL YES datetime NULL NULL NULL NULL NULL NULL datetime select
def information_schema PLUGINS LOAD_OPTION 11 NO varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PLUGINS PLUGIN_AUTHOR 8 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
def information_schema PLUGINS PLUGIN_DESCRIPTION 9 NULL YES longtext 4294967295 4294967295 NULL NULL utf8 utf8_general_ci longtext select
def information_schema PLUGINS PLUGIN_LIBRARY 6 NULL YES varchar 64 192 NULL NULL utf8 utf8_general_ci varchar(64) select
...
...
@@ -562,6 +563,7 @@ NULL information_schema PARTITIONS CHECKSUM bigint NULL NULL NULL NULL bigint(21
3.0000 information_schema PLUGINS PLUGIN_AUTHOR varchar 64 192 utf8 utf8_general_ci varchar(64)
1.0000 information_schema PLUGINS PLUGIN_DESCRIPTION longtext 4294967295 4294967295 utf8 utf8_general_ci longtext
3.0000 information_schema PLUGINS PLUGIN_LICENSE varchar 80 240 utf8 utf8_general_ci varchar(80)
3.0000 information_schema PLUGINS LOAD_OPTION varchar 64 192 utf8 utf8_general_ci varchar(64)
NULL information_schema PROCESSLIST ID bigint NULL NULL NULL NULL bigint(4)
3.0000 information_schema PROCESSLIST USER varchar 16 48 utf8 utf8_general_ci varchar(16)
3.0000 information_schema PROCESSLIST HOST varchar 64 192 utf8 utf8_general_ci varchar(64)
...
...
mysql-test/t/plugin_load_option-master.opt
0 → 100644
View file @
85d023eb
$EXAMPLE_PLUGIN_OPT
$EXAMPLE_PLUGIN_LOAD
--plugin-example=FORCE_PLUS_PERMANENT
mysql-test/t/plugin_load_option.test
0 → 100644
View file @
85d023eb
--
source
include
/
not_windows_embedded
.
inc
--
source
include
/
have_example_plugin
.
inc
--
error
ER_PLUGIN_IS_PERMANENT
UNINSTALL
PLUGIN
example
;
SELECT
PLUGIN_NAME
,
PLUGIN_STATUS
,
LOAD_OPTION
FROM
INFORMATION_SCHEMA
.
PLUGINS
WHERE
PLUGIN_NAME
IN
(
'MyISAM'
,
'EXAMPLE'
);
sql/share/errmsg-utf8.txt
View file @
85d023eb
...
...
@@ -6382,3 +6382,6 @@ ER_GRANT_PLUGIN_USER_EXISTS
ER_TRUNCATE_ILLEGAL_FK 42000
eng "Cannot truncate a table referenced in a foreign key constraint (%.192s)"
ER_PLUGIN_IS_PERMANENT
eng "Plugin '%s' is force_plus_permanent and can not be unloaded"
sql/sql_plugin.cc
View file @
85d023eb
...
...
@@ -42,9 +42,8 @@ extern struct st_mysql_plugin *mysql_mandatory_plugins[];
@note The order of the enumeration is critical.
@see construct_options
*/
static
const
char
*
global_plugin_typelib_names
[]
=
{
"OFF"
,
"ON"
,
"FORCE"
,
NULL
};
enum
enum_plugin_load_policy
{
PLUGIN_OFF
,
PLUGIN_ON
,
PLUGIN_FORCE
};
const
char
*
global_plugin_typelib_names
[]
=
{
"OFF"
,
"ON"
,
"FORCE"
,
"FORCE_PLUS_PERMANENT"
,
NULL
};
static
TYPELIB
global_plugin_typelib
=
{
array_elements
(
global_plugin_typelib_names
)
-
1
,
""
,
global_plugin_typelib_names
,
NULL
};
...
...
@@ -800,6 +799,7 @@ static bool plugin_add(MEM_ROOT *tmp_root,
tmp
.
name
.
length
=
name_len
;
tmp
.
ref_count
=
0
;
tmp
.
state
=
PLUGIN_IS_UNINITIALIZED
;
tmp
.
load_option
=
PLUGIN_ON
;
if
(
test_plugin_options
(
tmp_root
,
&
tmp
,
argc
,
argv
))
tmp
.
state
=
PLUGIN_IS_DISABLED
;
...
...
@@ -1241,7 +1241,7 @@ int plugin_init(int *argc, char **argv, int flags)
tmp
.
name
.
str
=
(
char
*
)
plugin
->
name
;
tmp
.
name
.
length
=
strlen
(
plugin
->
name
);
tmp
.
state
=
0
;
tmp
.
is_mandatory
=
mandatory
;
tmp
.
load_option
=
mandatory
?
PLUGIN_FORCE
:
PLUGIN_ON
;
/*
If the performance schema is compiled in,
...
...
@@ -1260,7 +1260,7 @@ int plugin_init(int *argc, char **argv, int flags)
to work, by using '--skip-performance-schema' (the plugin)
*/
if
(
!
my_strcasecmp
(
&
my_charset_latin1
,
plugin
->
name
,
"PERFORMANCE_SCHEMA"
))
tmp
.
is_mandatory
=
true
;
tmp
.
load_option
=
PLUGIN_FORCE
;
free_root
(
&
tmp_root
,
MYF
(
MY_MARK_BLOCKS_FREE
));
if
(
test_plugin_options
(
&
tmp_root
,
&
tmp
,
argc
,
argv
))
...
...
@@ -1338,7 +1338,8 @@ int plugin_init(int *argc, char **argv, int flags)
while
((
plugin_ptr
=
*
(
--
reap
)))
{
mysql_mutex_unlock
(
&
LOCK_plugin
);
if
(
plugin_ptr
->
is_mandatory
)
if
(
plugin_ptr
->
load_option
==
PLUGIN_FORCE
||
plugin_ptr
->
load_option
==
PLUGIN_FORCE_PLUS_PERMANENT
)
reaped_mandatory_plugin
=
TRUE
;
plugin_deinitialize
(
plugin_ptr
,
true
);
mysql_mutex_lock
(
&
LOCK_plugin
);
...
...
@@ -1848,6 +1849,11 @@ bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name)
my_error
(
ER_SP_DOES_NOT_EXIST
,
MYF
(
0
),
"PLUGIN"
,
name
->
str
);
goto
err
;
}
if
(
plugin
->
load_option
==
PLUGIN_FORCE_PLUS_PERMANENT
)
{
my_error
(
ER_PLUGIN_IS_PERMANENT
,
MYF
(
0
),
name
->
str
);
goto
err
;
}
plugin
->
state
=
PLUGIN_IS_DELETED
;
if
(
plugin
->
ref_count
)
...
...
@@ -3058,7 +3064,8 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
plugin_dash
.
length
+
1
);
strxmov
(
plugin_name_with_prefix_ptr
,
plugin_dash
.
str
,
plugin_name_ptr
,
NullS
);
if
(
!
tmp
->
is_mandatory
)
if
(
tmp
->
load_option
!=
PLUGIN_FORCE
&&
tmp
->
load_option
!=
PLUGIN_FORCE_PLUS_PERMANENT
)
{
/* support --skip-plugin-foo syntax */
options
[
0
].
name
=
plugin_name_ptr
;
...
...
@@ -3318,7 +3325,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
{
struct
sys_var_chain
chain
=
{
NULL
,
NULL
};
bool
disable_plugin
;
enum_plugin_load_
policy
plugin_load_policy
=
tmp
->
is_mandatory
?
PLUGIN_FORCE
:
PLUGIN_ON
;
enum_plugin_load_
option
plugin_load_option
=
tmp
->
load_option
;
MEM_ROOT
*
mem_root
=
alloc_root_inited
(
&
tmp
->
mem_root
)
?
&
tmp
->
mem_root
:
&
plugin_mem_root
;
...
...
@@ -3339,7 +3346,7 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
*/
if
(
!
(
my_strcasecmp
(
&
my_charset_latin1
,
tmp
->
name
.
str
,
"federated"
)
&&
my_strcasecmp
(
&
my_charset_latin1
,
tmp
->
name
.
str
,
"ndbcluster"
)))
plugin_load_
policy
=
PLUGIN_OFF
;
plugin_load_
option
=
PLUGIN_OFF
;
for
(
opt
=
tmp
->
plugin
->
system_vars
;
opt
&&
*
opt
;
opt
++
)
count
+=
2
;
/* --{plugin}-{optname} and --plugin-{plugin}-{optname} */
...
...
@@ -3363,8 +3370,9 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
We adjust the default value to account for the hardcoded exceptions
we have set for the federated and ndbcluster storage engines.
*/
if
(
!
tmp
->
is_mandatory
)
opts
[
0
].
def_value
=
opts
[
1
].
def_value
=
plugin_load_policy
;
if
(
tmp
->
load_option
!=
PLUGIN_FORCE
&&
tmp
->
load_option
!=
PLUGIN_FORCE_PLUS_PERMANENT
)
opts
[
0
].
def_value
=
opts
[
1
].
def_value
=
plugin_load_option
;
error
=
handle_options
(
argc
,
&
argv
,
opts
,
NULL
);
(
*
argc
)
++
;
/* add back one for the program name */
...
...
@@ -3379,12 +3387,13 @@ static int test_plugin_options(MEM_ROOT *tmp_root, struct st_plugin_int *tmp,
Set plugin loading policy from option value. First element in the option
list is always the <plugin name> option value.
*/
if
(
!
tmp
->
is_mandatory
)
plugin_load_policy
=
(
enum_plugin_load_policy
)
*
(
ulong
*
)
opts
[
0
].
value
;
if
(
tmp
->
load_option
!=
PLUGIN_FORCE
&&
tmp
->
load_option
!=
PLUGIN_FORCE_PLUS_PERMANENT
)
plugin_load_option
=
(
enum_plugin_load_option
)
*
(
ulong
*
)
opts
[
0
].
value
;
}
disable_plugin
=
(
plugin_load_
policy
==
PLUGIN_OFF
);
tmp
->
is_mandatory
=
(
plugin_load_policy
==
PLUGIN_FORCE
)
;
disable_plugin
=
(
plugin_load_
option
==
PLUGIN_OFF
);
tmp
->
load_option
=
plugin_load_option
;
/*
If the plugin is disabled it should not be initialized.
...
...
sql/sql_plugin.h
View file @
85d023eb
...
...
@@ -32,6 +32,9 @@
class
sys_var
;
enum
SHOW_COMP_OPTION
{
SHOW_OPTION_YES
,
SHOW_OPTION_NO
,
SHOW_OPTION_DISABLED
};
enum
enum_plugin_load_option
{
PLUGIN_OFF
,
PLUGIN_ON
,
PLUGIN_FORCE
,
PLUGIN_FORCE_PLUS_PERMANENT
};
extern
const
char
*
global_plugin_typelib_names
[];
#include <my_sys.h>
...
...
@@ -95,7 +98,7 @@ struct st_plugin_int
void
*
data
;
/* plugin type specific, e.g. handlerton */
MEM_ROOT
mem_root
;
/* memory for dynamic plugin structures */
sys_var
*
system_vars
;
/* server variables for this plugin */
bool
is_mandatory
;
/* If true then plugin must not fail to load
*/
enum
enum_plugin_load_option
load_option
;
/* OFF, ON, FORCE, F+PERMANENT
*/
};
...
...
@@ -110,6 +113,7 @@ typedef struct st_plugin_int *plugin_ref;
#define plugin_data(pi,cast) ((cast)((pi)->data))
#define plugin_name(pi) (&((pi)->name))
#define plugin_state(pi) ((pi)->state)
#define plugin_load_option(pi) ((pi)->load_option)
#define plugin_equals(p1,p2) ((p1) == (p2))
#else
typedef
struct
st_plugin_int
**
plugin_ref
;
...
...
@@ -118,6 +122,7 @@ typedef struct st_plugin_int **plugin_ref;
#define plugin_data(pi,cast) ((cast)((pi)[0]->data))
#define plugin_name(pi) (&((pi)[0]->name))
#define plugin_state(pi) ((pi)[0]->state)
#define plugin_load_option(pi) ((pi)[0]->load_option)
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1)[0] == (p2)[0])
#endif
...
...
sql/sql_show.cc
View file @
85d023eb
...
...
@@ -211,6 +211,11 @@ static my_bool show_plugins(THD *thd, plugin_ref plugin,
}
table
->
field
[
9
]
->
set_notnull
();
table
->
field
[
10
]
->
store
(
global_plugin_typelib_names
[
plugin_load_option
(
plugin
)],
strlen
(
global_plugin_typelib_names
[
plugin_load_option
(
plugin
)]),
cs
);
return
schema_table_store_record
(
thd
,
table
);
}
...
...
@@ -7214,6 +7219,7 @@ ST_FIELD_INFO plugin_fields_info[]=
{
"PLUGIN_AUTHOR"
,
NAME_CHAR_LEN
,
MYSQL_TYPE_STRING
,
0
,
1
,
0
,
SKIP_OPEN_TABLE
},
{
"PLUGIN_DESCRIPTION"
,
65535
,
MYSQL_TYPE_STRING
,
0
,
1
,
0
,
SKIP_OPEN_TABLE
},
{
"PLUGIN_LICENSE"
,
80
,
MYSQL_TYPE_STRING
,
0
,
1
,
"License"
,
SKIP_OPEN_TABLE
},
{
"LOAD_OPTION"
,
64
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
SKIP_OPEN_TABLE
},
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
SKIP_OPEN_TABLE
}
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment