mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#39746 - Debug flag breaks struct definition
(server crash) Altering a table with fulltext index[es] which use pluggable fulltext parser may cause server crash in debug builds. The problem was that ALTER TABLE code wrongly assigned fulltext parser name. Also fixed that altering a table with fulltext index[es] leave stale fulltext parser locks, which prevent fulltext parsers from being uninstalled after ALTER TABLE. mysql-test/include/have_simple_parser.inc: Added support for testing simple fulltext parser. mysql-test/mysql-test-run.pl: Added support for testing simple fulltext parser. mysql-test/r/fulltext_plugin.result: A test case for BUG#39746. mysql-test/r/have_simple_parser.require: Added support for testing simple fulltext parser. mysql-test/t/fulltext_plugin-master.opt: A test case for BUG#39746. mysql-test/t/fulltext_plugin.test: A test case for BUG#39746. sql/sql_table.cc: Fixed that alter table wrongly assigns fulltext parser name. parser_name member is only available during table creation. When we open existing table we must get parser_name from plugin_ref, which is handled by plugin_name() macro. sql/table.cc: Moved code that releases fulltext parsers into free_table_share(). This fixes stale fulltext parser locks set by ALTER TABLE, which are preventing fulltext parsers from being uninstalled.
This commit is contained in:
16
mysql-test/include/have_simple_parser.inc
Normal file
16
mysql-test/include/have_simple_parser.inc
Normal file
@ -0,0 +1,16 @@
|
||||
#
|
||||
# Check if server has support for loading udf's
|
||||
# i.e it will support dlopen
|
||||
#
|
||||
--require r/have_dynamic_loading.require
|
||||
disable_query_log;
|
||||
show variables like 'have_dynamic_loading';
|
||||
enable_query_log;
|
||||
|
||||
#
|
||||
# Check if the variable SIMPLE_PARSER is set
|
||||
#
|
||||
--require r/have_simple_parser.require
|
||||
disable_query_log;
|
||||
eval select LENGTH('$SIMPLE_PARSER') > 0 as 'have_simple_parser';
|
||||
enable_query_log;
|
@ -163,6 +163,7 @@ our $exe_my_print_defaults;
|
||||
our $exe_perror;
|
||||
our $lib_udf_example;
|
||||
our $lib_example_plugin;
|
||||
our $lib_simple_parser;
|
||||
our $exe_libtool;
|
||||
|
||||
our $opt_bench= 0;
|
||||
@ -1717,6 +1718,10 @@ sub executable_setup () {
|
||||
mtr_file_exists(vs_config_dirs('storage/example', 'ha_example.dll'),
|
||||
"$glob_basedir/storage/example/.libs/ha_example.so",);
|
||||
|
||||
# Look for the simple_parser library
|
||||
$lib_simple_parser=
|
||||
mtr_file_exists(vs_config_dirs('plugin/fulltext', 'mypluglib.dll'),
|
||||
"$glob_basedir/plugin/fulltext/.libs/mypluglib.so",);
|
||||
}
|
||||
|
||||
# Look for mysqltest executable
|
||||
@ -2199,6 +2204,14 @@ sub environment_setup () {
|
||||
$ENV{'EXAMPLE_PLUGIN_OPT'}=
|
||||
($lib_example_plugin ? "--plugin_dir=" . dirname($lib_example_plugin) : "");
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Add the path where mysqld will find mypluglib.so
|
||||
# ----------------------------------------------------
|
||||
$ENV{'SIMPLE_PARSER'}=
|
||||
($lib_simple_parser ? basename($lib_simple_parser) : "");
|
||||
$ENV{'SIMPLE_PARSER_OPT'}=
|
||||
($lib_simple_parser ? "--plugin_dir=" . dirname($lib_simple_parser) : "");
|
||||
|
||||
# ----------------------------------------------------
|
||||
# Setup env so childs can execute myisampack and myisamchk
|
||||
# ----------------------------------------------------
|
||||
|
5
mysql-test/r/fulltext_plugin.result
Normal file
5
mysql-test/r/fulltext_plugin.result
Normal file
@ -0,0 +1,5 @@
|
||||
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so';
|
||||
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
|
||||
ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser;
|
||||
DROP TABLE t1;
|
||||
UNINSTALL PLUGIN simple_parser;
|
2
mysql-test/r/have_simple_parser.require
Normal file
2
mysql-test/r/have_simple_parser.require
Normal file
@ -0,0 +1,2 @@
|
||||
have_simple_parser
|
||||
1
|
1
mysql-test/t/fulltext_plugin-master.opt
Normal file
1
mysql-test/t/fulltext_plugin-master.opt
Normal file
@ -0,0 +1 @@
|
||||
$SIMPLE_PARSER_OPT
|
10
mysql-test/t/fulltext_plugin.test
Normal file
10
mysql-test/t/fulltext_plugin.test
Normal file
@ -0,0 +1,10 @@
|
||||
--source include/have_simple_parser.inc
|
||||
|
||||
#
|
||||
# BUG#39746 - Debug flag breaks struct definition (server crash)
|
||||
#
|
||||
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so';
|
||||
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
|
||||
ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser;
|
||||
DROP TABLE t1;
|
||||
UNINSTALL PLUGIN simple_parser;
|
Reference in New Issue
Block a user