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
1c530b36
Commit
1c530b36
authored
Mar 05, 2012
by
Sergei Golubchik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
mdev-20: INSTALL PLUGIN SONAME
parent
98141ea4
Changes
11
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
330 additions
and
159 deletions
+330
-159
include/my_global.h
include/my_global.h
+0
-2
mysql-test/r/plugin.result
mysql-test/r/plugin.result
+50
-7
mysql-test/r/plugin_maturity.result
mysql-test/r/plugin_maturity.result
+7
-1
mysql-test/t/plugin.test
mysql-test/t/plugin.test
+14
-10
mysql-test/t/plugin_maturity.test
mysql-test/t/plugin_maturity.test
+6
-0
mysql-test/t/ps.test
mysql-test/t/ps.test
+0
-3
sql/sql_parse.cc
sql/sql_parse.cc
+2
-1
sql/sql_plugin.cc
sql/sql_plugin.cc
+204
-127
sql/sql_plugin.h
sql/sql_plugin.h
+2
-1
sql/sql_yacc.yy
sql/sql_yacc.yy
+14
-0
storage/example/ha_example.cc
storage/example/ha_example.cc
+31
-7
No files found.
include/my_global.h
View file @
1c530b36
...
@@ -462,8 +462,6 @@ extern "C" int madvise(void *addr, size_t len, int behav);
...
@@ -462,8 +462,6 @@ extern "C" int madvise(void *addr, size_t len, int behav);
#ifndef SO_EXT
#ifndef SO_EXT
#ifdef _WIN32
#ifdef _WIN32
#define SO_EXT ".dll"
#define SO_EXT ".dll"
#elif defined(__APPLE__)
#define SO_EXT ".dylib"
#else
#else
#define SO_EXT ".so"
#define SO_EXT ".so"
#endif
#endif
...
...
mysql-test/r/plugin.result
View file @
1c530b36
...
@@ -3,15 +3,41 @@ Warnings:
...
@@ -3,15 +3,41 @@ Warnings:
Warning 1286 Unknown storage engine 'EXAMPLE'
Warning 1286 Unknown storage engine 'EXAMPLE'
Warning 1266 Using storage engine MyISAM for table 't1'
Warning 1266 Using storage engine MyISAM for table 't1'
DROP TABLE t1;
DROP TABLE t1;
INSTALL PLUGIN example SONAME 'ha_example
.so
';
INSTALL PLUGIN example SONAME 'ha_example';
INSTALL PLUGIN EXAMPLE SONAME 'ha_example
.so
';
INSTALL PLUGIN EXAMPLE SONAME 'ha_example';
ERROR HY000: Function 'EXAMPLE' already exists
ERROR HY000: Function 'EXAMPLE' already exists
UNINSTALL PLUGIN example;
UNINSTALL PLUGIN example;
INSTALL PLUGIN example SONAME 'ha_example.so';
INSTALL SONAME 'ha_example';
select * from information_schema.plugins where plugin_library like 'ha_example%';
PLUGIN_NAME EXAMPLE
PLUGIN_VERSION 0.1
PLUGIN_STATUS ACTIVE
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
PLUGIN_LIBRARY_VERSION 1.1
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
LOAD_OPTION ON
PLUGIN_MATURITY Experimental
PLUGIN_AUTH_VERSION 0.1
PLUGIN_NAME UNUSABLE
PLUGIN_VERSION 3.14
PLUGIN_STATUS ACTIVE
PLUGIN_TYPE DAEMON
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
PLUGIN_LIBRARY_VERSION 1.1
PLUGIN_AUTHOR Sergei Golubchik
PLUGIN_DESCRIPTION Unusable Daemon
PLUGIN_LICENSE GPL
LOAD_OPTION ON
PLUGIN_MATURITY Experimental
PLUGIN_AUTH_VERSION 3.14.15.926
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
CREATE TABLE t1(a int) ENGINE=EXAMPLE;
SELECT * FROM t1;
SELECT * FROM t1;
a
a
DROP TABLE t1;
set global example_ulong_var=500;
set global example_ulong_var=500;
set global example_enum_var= e1;
set global example_enum_var= e1;
show status like 'example%';
show status like 'example%';
...
@@ -21,7 +47,24 @@ show variables like 'example%';
...
@@ -21,7 +47,24 @@ show variables like 'example%';
Variable_name Value
Variable_name Value
example_enum_var e1
example_enum_var e1
example_ulong_var 500
example_ulong_var 500
UNINSTALL PLUGIN example;
UNINSTALL SONAME 'ha_example';
Warnings:
Warning 1620 Plugin is busy and will be uninstalled on shutdown
select * from information_schema.plugins where plugin_library like 'ha_example%';
PLUGIN_NAME EXAMPLE
PLUGIN_VERSION 0.1
PLUGIN_STATUS DELETED
PLUGIN_TYPE STORAGE ENGINE
PLUGIN_TYPE_VERSION #
PLUGIN_LIBRARY ha_example.so
PLUGIN_LIBRARY_VERSION 1.1
PLUGIN_AUTHOR Brian Aker, MySQL AB
PLUGIN_DESCRIPTION Example storage engine
PLUGIN_LICENSE GPL
LOAD_OPTION ON
PLUGIN_MATURITY Experimental
PLUGIN_AUTH_VERSION 0.1
DROP TABLE t1;
UNINSTALL PLUGIN EXAMPLE;
UNINSTALL PLUGIN EXAMPLE;
ERROR 42000: PLUGIN EXAMPLE does not exist
ERROR 42000: PLUGIN EXAMPLE does not exist
UNINSTALL PLUGIN non_exist;
UNINSTALL PLUGIN non_exist;
...
@@ -30,13 +73,13 @@ ERROR 42000: PLUGIN non_exist does not exist
...
@@ -30,13 +73,13 @@ ERROR 42000: PLUGIN non_exist does not exist
# Bug#32034: check_func_enum() does not check correct values but set it
# Bug#32034: check_func_enum() does not check correct values but set it
# to impossible int val
# to impossible int val
#
#
INSTALL PLUGIN example SONAME 'ha_example
.so
';
INSTALL PLUGIN example SONAME 'ha_example';
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e1;
SET GLOBAL example_enum_var= e2;
SET GLOBAL example_enum_var= e2;
SET GLOBAL example_enum_var= impossible;
SET GLOBAL example_enum_var= impossible;
ERROR 42000: Variable 'example_enum_var' can't be set to the value of 'impossible'
ERROR 42000: Variable 'example_enum_var' can't be set to the value of 'impossible'
UNINSTALL PLUGIN example;
UNINSTALL PLUGIN example;
INSTALL PLUGIN example SONAME 'ha_example
.so
';
INSTALL PLUGIN example SONAME 'ha_example';
select @@session.sql_mode into @old_sql_mode;
select @@session.sql_mode into @old_sql_mode;
set session sql_mode='';
set session sql_mode='';
set global example_ulong_var=500;
set global example_ulong_var=500;
...
...
mysql-test/r/plugin_maturity.result
View file @
1c530b36
INSTALL PLUGIN example SONAME 'ha_example.so';
INSTALL PLUGIN example SONAME 'ha_example.so';
ERROR HY000: Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugins is prohibited by --plugin-maturity=stable)
ERROR HY000: Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
INSTALL SONAME 'ha_example.so';
ERROR HY000: Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
show warnings;
Level Code Message
Error 1126 Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin EXAMPLE is prohibited by --plugin-maturity=stable)
Error 1126 Can't open shared library 'ha_example.so' (errno: 0 Loading of experimental plugin UNUSABLE is prohibited by --plugin-maturity=stable)
mysql-test/t/plugin.test
View file @
1c530b36
...
@@ -4,23 +4,23 @@
...
@@ -4,23 +4,23 @@
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
EXAMPLE
;
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
EXAMPLE
;
DROP
TABLE
t1
;
DROP
TABLE
t1
;
--
replace_regex
/
\
.
dll
/.
so
/
eval
INSTALL
PLUGIN
example
SONAME
'ha_example'
;
eval
INSTALL
PLUGIN
example
SONAME
'$HA_EXAMPLE_SO'
;
--
replace_regex
/
\
.
dll
/.
so
/
--
replace_regex
/
\
.
dll
/.
so
/
--
error
1125
--
error
1125
eval
INSTALL
PLUGIN
EXAMPLE
SONAME
'
$HA_EXAMPLE_SO
'
;
eval
INSTALL
PLUGIN
EXAMPLE
SONAME
'
ha_example
'
;
UNINSTALL
PLUGIN
example
;
UNINSTALL
PLUGIN
example
;
eval
INSTALL
SONAME
'ha_example'
;
--
replace_column
5
#
--
replace_regex
/
\
.
dll
/.
so
/
--
replace_regex
/
\
.
dll
/.
so
/
eval
INSTALL
PLUGIN
example
SONAME
'$HA_EXAMPLE_SO'
;
--
query_vertical
select
*
from
information_schema
.
plugins
where
plugin_library
like
'ha_example%'
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
EXAMPLE
;
CREATE
TABLE
t1
(
a
int
)
ENGINE
=
EXAMPLE
;
# Let's do some advanced ops with the example engine :)
# Let's do some advanced ops with the example engine :)
SELECT
*
FROM
t1
;
SELECT
*
FROM
t1
;
DROP
TABLE
t1
;
# a couple of tests for variables
# a couple of tests for variables
set
global
example_ulong_var
=
500
;
set
global
example_ulong_var
=
500
;
...
@@ -28,7 +28,13 @@ set global example_enum_var= e1;
...
@@ -28,7 +28,13 @@ set global example_enum_var= e1;
show
status
like
'example%'
;
show
status
like
'example%'
;
show
variables
like
'example%'
;
show
variables
like
'example%'
;
UNINSTALL
PLUGIN
example
;
eval
UNINSTALL
SONAME
'ha_example'
;
--
replace_column
5
#
--
replace_regex
/
\
.
dll
/.
so
/
--
query_vertical
select
*
from
information_schema
.
plugins
where
plugin_library
like
'ha_example%'
DROP
TABLE
t1
;
--
error
1305
--
error
1305
UNINSTALL
PLUGIN
EXAMPLE
;
UNINSTALL
PLUGIN
EXAMPLE
;
...
@@ -40,8 +46,7 @@ UNINSTALL PLUGIN non_exist;
...
@@ -40,8 +46,7 @@ UNINSTALL PLUGIN non_exist;
--
echo
# Bug#32034: check_func_enum() does not check correct values but set it
--
echo
# Bug#32034: check_func_enum() does not check correct values but set it
--
echo
# to impossible int val
--
echo
# to impossible int val
--
echo
#
--
echo
#
--
replace_regex
/
\
.
dll
/.
so
/
eval
INSTALL
PLUGIN
example
SONAME
'ha_example'
;
eval
INSTALL
PLUGIN
example
SONAME
'$HA_EXAMPLE_SO'
;
SET
GLOBAL
example_enum_var
=
e1
;
SET
GLOBAL
example_enum_var
=
e1
;
SET
GLOBAL
example_enum_var
=
e2
;
SET
GLOBAL
example_enum_var
=
e2
;
...
@@ -55,8 +60,7 @@ UNINSTALL PLUGIN example;
...
@@ -55,8 +60,7 @@ UNINSTALL PLUGIN example;
#
#
# Bug #32757 hang with sql_mode set when setting some global variables
# Bug #32757 hang with sql_mode set when setting some global variables
#
#
--
replace_regex
/
\
.
dll
/.
so
/
eval
INSTALL
PLUGIN
example
SONAME
'ha_example'
;
eval
INSTALL
PLUGIN
example
SONAME
'$HA_EXAMPLE_SO'
;
select
@@
session
.
sql_mode
into
@
old_sql_mode
;
select
@@
session
.
sql_mode
into
@
old_sql_mode
;
...
...
mysql-test/t/plugin_maturity.test
View file @
1c530b36
...
@@ -4,3 +4,9 @@
...
@@ -4,3 +4,9 @@
--
replace_regex
/
\
.
dll
/.
so
/
--
replace_regex
/
\
.
dll
/.
so
/
--
error
1126
--
error
1126
eval
INSTALL
PLUGIN
example
SONAME
'$HA_EXAMPLE_SO'
;
eval
INSTALL
PLUGIN
example
SONAME
'$HA_EXAMPLE_SO'
;
--
replace_regex
/
\
.
dll
/.
so
/
--
error
1126
eval
INSTALL
SONAME
'$HA_EXAMPLE_SO'
;
--
replace_regex
/
\
.
dll
/.
so
/
show
warnings
;
mysql-test/t/ps.test
View file @
1c530b36
...
@@ -2594,13 +2594,10 @@ drop table t1;
...
@@ -2594,13 +2594,10 @@ drop table t1;
create
procedure
proc_1
()
install
plugin
my_plug
soname
'some_plugin.so'
;
create
procedure
proc_1
()
install
plugin
my_plug
soname
'some_plugin.so'
;
--
replace_regex
/
(
Can
\
't open shared library).*$/\1/
--
error
ER_CANT_OPEN_LIBRARY
,
ER_FEATURE_DISABLED
--
error
ER_CANT_OPEN_LIBRARY
,
ER_FEATURE_DISABLED
call
proc_1
();
call
proc_1
();
--replace_regex /(Can\'t open shared library).*$/\1/
--
error
ER_CANT_OPEN_LIBRARY
,
ER_FEATURE_DISABLED
--
error
ER_CANT_OPEN_LIBRARY
,
ER_FEATURE_DISABLED
call
proc_1
();
call
proc_1
();
--replace_regex /(Can\'t open shared library).*$/\1/
--
error
ER_CANT_OPEN_LIBRARY
,
ER_FEATURE_DISABLED
--
error
ER_CANT_OPEN_LIBRARY
,
ER_FEATURE_DISABLED
call
proc_1
();
call
proc_1
();
drop
procedure
proc_1
;
drop
procedure
proc_1
;
...
...
sql/sql_parse.cc
View file @
1c530b36
...
@@ -4363,7 +4363,8 @@ create_sp_error:
...
@@ -4363,7 +4363,8 @@ create_sp_error:
my_ok
(
thd
);
my_ok
(
thd
);
break
;
break
;
case
SQLCOM_UNINSTALL_PLUGIN
:
case
SQLCOM_UNINSTALL_PLUGIN
:
if
(
!
(
res
=
mysql_uninstall_plugin
(
thd
,
&
thd
->
lex
->
comment
)))
if
(
!
(
res
=
mysql_uninstall_plugin
(
thd
,
&
thd
->
lex
->
comment
,
&
thd
->
lex
->
ident
)))
my_ok
(
thd
);
my_ok
(
thd
);
break
;
break
;
case
SQLCOM_BINLOG_BASE64_EVENT
:
case
SQLCOM_BINLOG_BASE64_EVENT
:
...
...
sql/sql_plugin.cc
View file @
1c530b36
This diff is collapsed.
Click to expand it.
sql/sql_plugin.h
View file @
1c530b36
...
@@ -159,7 +159,8 @@ extern void plugin_unlock(THD *thd, plugin_ref plugin);
...
@@ -159,7 +159,8 @@ extern void plugin_unlock(THD *thd, plugin_ref plugin);
extern
void
plugin_unlock_list
(
THD
*
thd
,
plugin_ref
*
list
,
uint
count
);
extern
void
plugin_unlock_list
(
THD
*
thd
,
plugin_ref
*
list
,
uint
count
);
extern
bool
mysql_install_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
,
extern
bool
mysql_install_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
,
const
LEX_STRING
*
dl
);
const
LEX_STRING
*
dl
);
extern
bool
mysql_uninstall_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
);
extern
bool
mysql_uninstall_plugin
(
THD
*
thd
,
const
LEX_STRING
*
name
,
const
LEX_STRING
*
dl
);
extern
bool
plugin_register_builtin
(
struct
st_mysql_plugin
*
plugin
);
extern
bool
plugin_register_builtin
(
struct
st_mysql_plugin
*
plugin
);
extern
void
plugin_thdvar_init
(
THD
*
thd
);
extern
void
plugin_thdvar_init
(
THD
*
thd
);
extern
void
plugin_thdvar_cleanup
(
THD
*
thd
);
extern
void
plugin_thdvar_cleanup
(
THD
*
thd
);
...
...
sql/sql_yacc.yy
View file @
1c530b36
...
@@ -15141,6 +15141,13 @@ install:
...
@@ -15141,6 +15141,13 @@ install:
lex->comment= $3;
lex->comment= $3;
lex->ident= $5;
lex->ident= $5;
}
}
| INSTALL_SYM SONAME_SYM TEXT_STRING_sys
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_INSTALL_PLUGIN;
lex->comment= null_lex_str;
lex->ident= $3;
}
;
;
uninstall:
uninstall:
...
@@ -15150,6 +15157,13 @@ uninstall:
...
@@ -15150,6 +15157,13 @@ uninstall:
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
lex->comment= $3;
lex->comment= $3;
}
}
| UNINSTALL_SYM SONAME_SYM TEXT_STRING_sys
{
LEX *lex= Lex;
lex->sql_command= SQLCOM_UNINSTALL_PLUGIN;
lex->comment= null_lex_str;
lex->ident= $3;
}
;
;
/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */
/* Avoid compiler warning from sql_yacc.cc where yyerrlab1 is not used */
...
...
storage/example/ha_example.cc
View file @
1c530b36
...
@@ -19,17 +19,23 @@
...
@@ -19,17 +19,23 @@
@brief
@brief
The ha_example engine is a stubbed storage engine for example purposes only;
The ha_example engine is a stubbed storage engine for example purposes only;
it does nothing at this point. Its purpose is to provide a source
it does
almost
nothing at this point. Its purpose is to provide a source
code illustration of how to begin writing new storage engines; see also
code illustration of how to begin writing new storage engines; see also
/storage/example/ha_example.h.
storage/example/ha_example.h.
Additionally, this file includes an example of a daemon plugin which does
nothing at all - absolutely nothing, even less than example storage engine.
But it shows that one dll/so can contain more than one plugin.
@details
@details
ha_example will let you create/open/delete tables, but
ha_example will let you create/open/delete tables, but
nothing further (for example, indexes are not supported nor can data
nothing further (for example, indexes are not supported nor can data
be stored in the table). Use this example as a template for
be stored in the table). It also provides new status (example_func_example)
implementing the same functionality in your own storage engine. You
and system (example_ulong_var and example_enum_var) variables.
can enable the example storage engine in your build by doing the
following during your build process:<br> ./configure
Use this example as a template for implementing the same functionality in
your own storage engine. You can enable the example storage engine in your
build by doing the following during your build process:<br> ./configure
--with-example-storage-engine
--with-example-storage-engine
Once this is done, MySQL will let you create tables with:<br>
Once this is done, MySQL will let you create tables with:<br>
...
@@ -1111,6 +1117,9 @@ static struct st_mysql_show_var func_status[]=
...
@@ -1111,6 +1117,9 @@ static struct st_mysql_show_var func_status[]=
{
0
,
0
,
SHOW_UNDEF
}
{
0
,
0
,
SHOW_UNDEF
}
};
};
struct
st_mysql_daemon
unusable_example
=
{
MYSQL_DAEMON_INTERFACE_VERSION
};
mysql_declare_plugin
(
example
)
mysql_declare_plugin
(
example
)
{
{
MYSQL_STORAGE_ENGINE_PLUGIN
,
MYSQL_STORAGE_ENGINE_PLUGIN
,
...
@@ -1138,10 +1147,25 @@ maria_declare_plugin(example)
...
@@ -1138,10 +1147,25 @@ maria_declare_plugin(example)
PLUGIN_LICENSE_GPL
,
PLUGIN_LICENSE_GPL
,
example_init_func
,
/* Plugin Init */
example_init_func
,
/* Plugin Init */
example_done_func
,
/* Plugin Deinit */
example_done_func
,
/* Plugin Deinit */
0x0001
/* 0.1 */
,
0x0001
,
/* version number (0.1) */
func_status
,
/* status variables */
func_status
,
/* status variables */
example_system_variables
,
/* system variables */
example_system_variables
,
/* system variables */
"0.1"
,
/* string version */
"0.1"
,
/* string version */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
/* maturity */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
/* maturity */
},
{
MYSQL_DAEMON_PLUGIN
,
&
unusable_example
,
"UNUSABLE"
,
"Sergei Golubchik"
,
"Unusable Daemon"
,
PLUGIN_LICENSE_GPL
,
NULL
,
/* Plugin Init */
NULL
,
/* Plugin Deinit */
0x030E
,
/* version number (3.14) */
NULL
,
/* status variables */
NULL
,
/* system variables */
"3.14.15.926"
,
/* version, as a string */
MariaDB_PLUGIN_MATURITY_EXPERIMENTAL
/* maturity */
}
}
maria_declare_plugin_end
;
maria_declare_plugin_end
;
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