summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-11-18 10:58:51 +0100
committerSergei Golubchik <serg@mariadb.org>2015-11-18 11:23:15 +0100
commit726162989bdffca6af4a83c018a7d8eafeb82e6f (patch)
tree9224263a1d21f20631367f287fc7af7307ccc235
parente669a5fd87b28158cbb4454b4bcce7fe4a4ef8b8 (diff)
downloadmariadb-git-726162989bdffca6af4a83c018a7d8eafeb82e6f.tar.gz
feedback plugin debug
make it possible to change feedback plugin wait intervals * only in debug builds * and force the feedback report to be ignored update the test to use this feature
-rw-r--r--mysql-test/include/default_mysqld.cnf3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_install.result3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_load.result3
-rw-r--r--mysql-test/suite/plugins/r/feedback_plugin_send.result9
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_install.test4
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_load.test3
-rw-r--r--mysql-test/suite/plugins/t/feedback_plugin_send.test15
-rw-r--r--plugin/feedback/feedback.cc33
-rw-r--r--plugin/feedback/feedback.h4
-rw-r--r--plugin/feedback/sender_thread.cc6
10 files changed, 61 insertions, 22 deletions
diff --git a/mysql-test/include/default_mysqld.cnf b/mysql-test/include/default_mysqld.cnf
index 96848c39f11..40d699ce759 100644
--- a/mysql-test/include/default_mysqld.cnf
+++ b/mysql-test/include/default_mysqld.cnf
@@ -38,6 +38,9 @@ max_heap_table_size= 1M
loose-aria-pagecache-buffer-size=8M
loose-feedback-user-info= mysql-test
+loose-feedback-debug-startup-interval=20
+loose-feedback-debug-first-interval=60
+loose-feedback-debug-interval=60
loose-innodb_data_file_path= ibdata1:10M:autoextend
loose-innodb_buffer_pool_size= 8M
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_install.result b/mysql-test/suite/plugins/r/feedback_plugin_install.result
index 37d26b48501..c52fdb8f85b 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_install.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_install.result
@@ -3,7 +3,8 @@ 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';
+ and variable_name not like '%_uid'
+ and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK used 1
FEEDBACK version 1.1
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_load.result b/mysql-test/suite/plugins/r/feedback_plugin_load.result
index ea6eae98601..e2cf3247022 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_load.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_load.result
@@ -6,7 +6,8 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+ and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
diff --git a/mysql-test/suite/plugins/r/feedback_plugin_send.result b/mysql-test/suite/plugins/r/feedback_plugin_send.result
index 90a37f7ffbc..56a4e37981c 100644
--- a/mysql-test/suite/plugins/r/feedback_plugin_send.result
+++ b/mysql-test/suite/plugins/r/feedback_plugin_send.result
@@ -6,14 +6,13 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
variable_value = @feedback_used + 1
1
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+ and variable_name not like '%debug%';
VARIABLE_NAME VARIABLE_VALUE
FEEDBACK version 1.1
FEEDBACK_SEND_RETRY_WAIT 60
FEEDBACK_SEND_TIMEOUT 60
FEEDBACK_URL http://mariadb.org/feedback_plugin/post
FEEDBACK_USER_INFO mysql-test
-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'
+6: feedback plugin: report to 'http://mariadb.org/feedback_plugin/post' was sent
+6: feedback plugin: server replied 'ok'
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_install.test b/mysql-test/suite/plugins/t/feedback_plugin_install.test
index 81343c436c3..559dcebfc05 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_install.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_install.test
@@ -10,6 +10,8 @@ select plugin_status from information_schema.plugins where plugin_name='feedback
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid';
+ and variable_name not like '%_uid'
+ and variable_name not like '%debug%';
+
uninstall plugin feedback;
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_load.test b/mysql-test/suite/plugins/t/feedback_plugin_load.test
index f7c62b96b49..f626f1b0125 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_load.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_load.test
@@ -24,4 +24,5 @@ SELECT variable_value = @feedback_used + 1 FROM information_schema.feedback wher
--replace_result https http
--sorted_result
select * from information_schema.feedback where variable_name like 'feed%'
- and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used';
+ and variable_name not like '%_uid' and variable_name not like 'FEEDBACK used'
+ and variable_name not like '%debug%';
diff --git a/mysql-test/suite/plugins/t/feedback_plugin_send.test b/mysql-test/suite/plugins/t/feedback_plugin_send.test
index 31542c33482..31ab213831e 100644
--- a/mysql-test/suite/plugins/t/feedback_plugin_send.test
+++ b/mysql-test/suite/plugins/t/feedback_plugin_send.test
@@ -25,20 +25,15 @@ sleep 310;
--let $shutdown_timeout= 60
source include/restart_mysqld.inc;
-replace_result https http;
+replace_result https http 2 6;
perl;
$log_error= $ENV{'MYSQLTEST_VARDIR'} . '/log/mysqld.1.err';
open(LOG, '<', $log_error) or die "open(< $log_error): $!";
- # Get the first few rows (as there may be different number rows in the log)
- $i= 0;
- while ($_=<LOG>)
- {
- if (/feedback plugin:.*/)
- {
- print "$&\n";
- break if ($i++ >= 3);
- }
+ %logg=();
+ while ($_=<LOG>) {
+ $logg{$&}++ if /feedback plugin:.*/;
}
+ print "$logg{$_}: $_\n" for sort keys %logg;
close LOG;
EOF
diff --git a/plugin/feedback/feedback.cc b/plugin/feedback/feedback.cc
index 9bf2fcb99bc..f87caa54cbc 100644
--- a/plugin/feedback/feedback.cc
+++ b/plugin/feedback/feedback.cc
@@ -22,6 +22,10 @@ extern ST_SCHEMA_TABLE schema_tables[];
namespace feedback {
+#ifndef DBUG_OFF
+ulong debug_startup_interval, debug_first_interval, debug_interval;
+#endif
+
char server_uid_buf[SERVER_UID_SIZE+1]; ///< server uid will be written here
/* backing store for system variables */
@@ -249,6 +253,18 @@ static int init(void *p)
prepare_linux_info();
+#ifndef DBUG_OFF
+ if (startup_interval != debug_startup_interval ||
+ first_interval != debug_first_interval ||
+ interval != debug_interval)
+ {
+ startup_interval= debug_startup_interval;
+ first_interval= debug_first_interval;
+ interval= debug_interval;
+ user_info= "mysql-test";
+ }
+#endif
+
url_count= 0;
if (*url)
{
@@ -347,12 +363,29 @@ static MYSQL_SYSVAR_ULONG(send_retry_wait, send_retry_wait, PLUGIN_VAR_RQCMDARG,
"Wait this many seconds before retrying a failed send.",
NULL, NULL, 60, 1, 60*60*24, 1);
+#ifndef DBUG_OFF
+static MYSQL_SYSVAR_ULONG(debug_startup_interval, debug_startup_interval,
+ PLUGIN_VAR_RQCMDARG, "for debugging only",
+ NULL, NULL, startup_interval, 1, INT_MAX32, 1);
+static MYSQL_SYSVAR_ULONG(debug_first_interval, debug_first_interval,
+ PLUGIN_VAR_RQCMDARG, "for debugging only",
+ NULL, NULL, first_interval, 1, INT_MAX32, 1);
+static MYSQL_SYSVAR_ULONG(debug_interval, debug_interval,
+ PLUGIN_VAR_RQCMDARG, "for debugging only",
+ NULL, NULL, interval, 1, INT_MAX32, 1);
+#endif
+
static struct st_mysql_sys_var* settings[] = {
MYSQL_SYSVAR(server_uid),
MYSQL_SYSVAR(user_info),
MYSQL_SYSVAR(url),
MYSQL_SYSVAR(send_timeout),
MYSQL_SYSVAR(send_retry_wait),
+#ifndef DBUG_OFF
+ MYSQL_SYSVAR(debug_startup_interval),
+ MYSQL_SYSVAR(debug_first_interval),
+ MYSQL_SYSVAR(debug_interval),
+#endif
NULL
};
diff --git a/plugin/feedback/feedback.h b/plugin/feedback/feedback.h
index c5acbb5ef72..63aa4f8db8a 100644
--- a/plugin/feedback/feedback.h
+++ b/plugin/feedback/feedback.h
@@ -58,6 +58,10 @@ class Url {
extern Url **urls;
extern uint url_count;
+extern time_t startup_interval;
+extern time_t first_interval;
+extern time_t interval;
+
/* these are used to communicate with the background thread */
extern mysql_mutex_t sleep_mutex;
extern mysql_cond_t sleep_condition;
diff --git a/plugin/feedback/sender_thread.cc b/plugin/feedback/sender_thread.cc
index 4ab45998484..abc3d0a18e6 100644
--- a/plugin/feedback/sender_thread.cc
+++ b/plugin/feedback/sender_thread.cc
@@ -25,9 +25,9 @@ static my_thread_id thd_thread_id; ///< its thread_id
static size_t needed_size= 20480;
-static const time_t startup_interval= 60*5; ///< in seconds (5 minutes)
-static const time_t first_interval= 60*60*24; ///< in seconds (one day)
-static const time_t interval= 60*60*24*7; ///< in seconds (one week)
+time_t startup_interval= 60*5; ///< in seconds (5 minutes)
+time_t first_interval= 60*60*24; ///< in seconds (one day)
+time_t interval= 60*60*24*7; ///< in seconds (one week)
/**
reads the rows from a table and puts them, concatenated, in a String