Commit 1b7e5666 authored by Sergei Golubchik's avatar Sergei Golubchik

tests for feedback plugin,

bugfix: garbage in PLUGIN_VAR_STR variables when INSTALL'ing a plugin

mysql-test/include/default_mysqld.cnf:
  disable feedback plugin by default.
  when enabled - tag is as a test run
parent 031e78dd
......@@ -15,6 +15,8 @@ max_heap_table_size= 1M
loose-skip-innodb
loose-skip-pbxt
loose-skip-feedback
loose-feedback-user-info= mysql-test
loose-innodb_data_file_path= ibdata1:10M:autoextend
......
install plugin feedback soname 'feedback.so';
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_USER_INFO mysql-test
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
FEEDBACK 1.0
uninstall plugin feedback;
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_USER_INFO mysql-test
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
FEEDBACK 1.0
select plugin_status from information_schema.plugins where plugin_name='feedback';
plugin_status
ACTIVE
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_USER_INFO mysql-test
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
FEEDBACK 1.0
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
feedback plugin: server replied 'ok'
feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
feedback plugin: server replied 'ok'
--source include/not_embedded.inc
if (`select length('$FEEDBACK_SO') = 0`) {
skip No feedback plugin;
}
--replace_regex /\.dll/.so/
eval install plugin feedback soname '$FEEDBACK_SO';
select plugin_status from information_schema.plugins where plugin_name='feedback';
--replace_result https http
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
uninstall plugin feedback;
--loose-feedback
--plugin-load=$FEEDBACK_SO
if (`select count(*) = 0 from information_schema.plugins where plugin_name = 'feedback' and plugin_status='active'`)
{
--skip Feedback plugin is not active
}
select plugin_status from information_schema.plugins where plugin_name='feedback';
--replace_result https http
select * from information_schema.feedback where variable_name like 'feed%'
and variable_name not like '%_uid';
source t/feedback_plugin_load.test;
source include/big_test.inc;
if (!$MTR_FEEDBACK_PLUGIN) {
skip MTR_FEEDBACK_PLUGIN is not set;
}
#
# Yep. The plugin waits 5 minutes before sending anything,
# and there's no way to force it to send anything sooner.
# Let's wait, and hope that mtr is started with --parallel and
# is doing some work in other workers.
#
sleep 310;
source include/restart_mysqld.inc;
replace_result https http;
perl;
$log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err';
open(LOG, '<', $log_error) or die "open(< $log_error): $!";
/feedback plugin:.*/ && print "$&\n" while $_=<LOG>;
close LOG;
EOF
......@@ -3176,6 +3176,19 @@ static int construct_options(MEM_ROOT *mem_root, struct st_plugin_int *tmp,
opt->name, plugin_name);
}
}
/*
PLUGIN_VAR_STR command-line options without PLUGIN_VAR_MEMALLOC, point
directly to values in the argv[] array. For plugins started at the
server startup, argv[] array is allocated with load_defaults(), and
freed when the server is shut down. But for plugins loaded with
INSTALL PLUGIN, the memory allocated with load_defaults() is freed with
freed() at the end of mysql_install_plugin(). Which means we cannot
allow any pointers into that area.
Thus, for all plugins loaded after the server was started,
we force all command-line options to be PLUGIN_VAR_MEMALLOC
*/
if (mysqld_server_started && !(opt->flags & PLUGIN_VAR_NOCMDOPT))
opt->flags|= PLUGIN_VAR_MEMALLOC;
break;
case PLUGIN_VAR_ENUM:
if (!opt->check)
......
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