Commit 9021f40b authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-35050 Found wrong usage of mutex upon setting plugin session variables

parent b1bbdbab
#
# BUG#39746 - Debug flag breaks struct definition (server crash)
#
INSTALL PLUGIN simple_parser SONAME 'mypluglib.so'; INSTALL PLUGIN simple_parser SONAME 'mypluglib.so';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser; ALTER TABLE t1 ADD FULLTEXT(b) WITH PARSER simple_parser;
...@@ -5,3 +8,11 @@ DROP TABLE t1; ...@@ -5,3 +8,11 @@ DROP TABLE t1;
UNINSTALL PLUGIN simple_parser; UNINSTALL PLUGIN simple_parser;
show status like 'a%status'; show status like 'a%status';
Variable_name Value Variable_name Value
#
# MDEV-35050 Found wrong usage of mutex upon setting plugin session variables
#
install soname 'mypluglib';
set session_track_system_variables="*";
set session simple_parser_simple_thdvar_one = 10;
uninstall soname 'mypluglib';
# End of 10.5 tests
--source include/have_simple_parser.inc --source include/have_simple_parser.inc
# --echo #
# BUG#39746 - Debug flag breaks struct definition (server crash) --echo # BUG#39746 - Debug flag breaks struct definition (server crash)
# --echo #
--replace_result .dll .so --replace_result .dll .so
eval INSTALL PLUGIN simple_parser SONAME '$MYPLUGLIB_SO'; eval INSTALL PLUGIN simple_parser SONAME '$MYPLUGLIB_SO';
CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser); CREATE TABLE t1(a TEXT, b TEXT, FULLTEXT(a) WITH PARSER simple_parser);
...@@ -15,3 +15,12 @@ UNINSTALL PLUGIN simple_parser; ...@@ -15,3 +15,12 @@ UNINSTALL PLUGIN simple_parser;
# #
show status like 'a%status'; show status like 'a%status';
--echo #
--echo # MDEV-35050 Found wrong usage of mutex upon setting plugin session variables
--echo #
install soname 'mypluglib';
set session_track_system_variables="*";
set session simple_parser_simple_thdvar_one = 10;
uninstall soname 'mypluglib';
--echo # End of 10.5 tests
...@@ -428,6 +428,7 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) ...@@ -428,6 +428,7 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf)
SHOW_VAR show; SHOW_VAR show;
CHARSET_INFO *charset; CHARSET_INFO *charset;
size_t val_length, length; size_t val_length, length;
mysql_mutex_lock(&LOCK_global_system_variables);
mysql_mutex_lock(&LOCK_plugin); mysql_mutex_lock(&LOCK_plugin);
if (!*node->test_load) if (!*node->test_load)
{ {
...@@ -444,13 +445,12 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf) ...@@ -444,13 +445,12 @@ bool Session_sysvars_tracker::vars_list::store(THD *thd, String *buf)
show.name= svar->name.str; show.name= svar->name.str;
show.value= (char *) svar; show.value= (char *) svar;
mysql_mutex_lock(&LOCK_global_system_variables);
const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL, const char *value= get_one_variable(thd, &show, OPT_SESSION, SHOW_SYS, NULL,
&charset, val_buf, &val_length); &charset, val_buf, &val_length);
mysql_mutex_unlock(&LOCK_global_system_variables);
if (is_plugin) if (is_plugin)
mysql_mutex_unlock(&LOCK_plugin); mysql_mutex_unlock(&LOCK_plugin);
mysql_mutex_unlock(&LOCK_global_system_variables);
length= net_length_size(svar->name.length) + length= net_length_size(svar->name.length) +
svar->name.length + svar->name.length +
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment