summaryrefslogtreecommitdiff
path: root/plugin/query_response_time
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2014-08-25 19:08:01 +0200
committerSergei Golubchik <serg@mariadb.org>2014-10-11 18:53:04 +0200
commitdb8af31831beb949dfcf7675b3c6392dc52dc38c (patch)
tree875eb553866accbb0f05bfe8cbe3a789752d86f2 /plugin/query_response_time
parent932eaf31e91cf875e336b8d9332682aca03c6e58 (diff)
downloadmariadb-git-db8af31831beb949dfcf7675b3c6392dc52dc38c.tar.gz
SHOW and FLUSH for I_S tables.
Extend existing plugins to support * SHOW QUERY_RESPONSE_TIME * FLUSH QUERY_RESPONSE_TIME * SHOW LOCALE move userstat tables to use the new API instead of hand-coded syntax
Diffstat (limited to 'plugin/query_response_time')
-rw-r--r--plugin/query_response_time/mysql-test/query_response_time/query_response_time.inc4
-rw-r--r--plugin/query_response_time/mysql-test/query_response_time/query_response_time.result42
-rw-r--r--plugin/query_response_time/plugin.cc7
-rw-r--r--plugin/query_response_time/query_response_time.cc3
-rw-r--r--plugin/query_response_time/query_response_time.h2
5 files changed, 30 insertions, 28 deletions
diff --git a/plugin/query_response_time/mysql-test/query_response_time/query_response_time.inc b/plugin/query_response_time/mysql-test/query_response_time/query_response_time.inc
index 28ef3d8cd2a..d13215aa5d4 100644
--- a/plugin/query_response_time/mysql-test/query_response_time/query_response_time.inc
+++ b/plugin/query_response_time/mysql-test/query_response_time/query_response_time.inc
@@ -2,7 +2,7 @@ SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
EVAL SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=$base;
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
# Following two queries check works of FLUSH and
# respecting of "QUERY_RESPONSE_TIME_STATS" variable (see launchpad bug #855312)
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
@@ -36,6 +36,6 @@ SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
+SHOW QUERY_RESPONSE_TIME;
SET SESSION query_response_time_exec_time_debug=default;
diff --git a/plugin/query_response_time/mysql-test/query_response_time/query_response_time.result b/plugin/query_response_time/mysql-test/query_response_time/query_response_time.result
index eac4888c76c..14822c35915 100644
--- a/plugin/query_response_time/mysql-test/query_response_time/query_response_time.result
+++ b/plugin/query_response_time/mysql-test/query_response_time/query_response_time.result
@@ -3,7 +3,7 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1;
Warnings:
Warning 1292 Truncated incorrect query_response_time_range_base value: '1'
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000001 0 0.000000
@@ -144,8 +144,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000001 24 0.000000
0.000003 0 0.000000
0.000007 0 0.000000
@@ -194,7 +194,7 @@ SET SESSION query_response_time_exec_time_debug=default;
SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=2;
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000001 0 0.000000
@@ -335,8 +335,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 2
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000001 24 0.000000
0.000003 0 0.000000
0.000007 0 0.000000
@@ -385,7 +385,7 @@ SET SESSION query_response_time_exec_time_debug=default;
SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=10;
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000001 0 0.000000
@@ -496,8 +496,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 10
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000001 24 0.000000
0.000010 0 0.000000
0.000100 0 0.000000
@@ -516,7 +516,7 @@ SET SESSION query_response_time_exec_time_debug=default;
SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=7;
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000001 0 0.000000
@@ -630,8 +630,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 7
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000001 24 0.000000
0.000008 0 0.000000
0.000059 0 0.000000
@@ -653,7 +653,7 @@ SET SESSION query_response_time_exec_time_debug=default;
SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=156;
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000041 0 0.000000
@@ -757,8 +757,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 156
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000041 24 0.000000
0.006410 0 0.000000
1.000000 11 4.050000
@@ -770,7 +770,7 @@ SET SESSION query_response_time_exec_time_debug=default;
SET SESSION query_response_time_exec_time_debug=100000;
SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1000;
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000001 0 0.000000
@@ -873,8 +873,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000001 24 0.000000
0.001000 0 0.000000
1.000000 11 4.050000
@@ -887,7 +887,7 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SET GLOBAL QUERY_RESPONSE_TIME_RANGE_BASE=1001;
Warnings:
Warning 1292 Truncated incorrect query_response_time_range_base value: '1001'
-SET GLOBAL query_response_time_flush=1;
+FLUSH QUERY_RESPONSE_TIME;
SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
TIME COUNT TOTAL
0.000001 0 0.000000
@@ -990,8 +990,8 @@ SET GLOBAL QUERY_RESPONSE_TIME_STATS=0;
SHOW GLOBAL VARIABLES where Variable_name like 'QUERY_RESPONSE_TIME_RANGE_BASE';
Variable_name Value
query_response_time_range_base 1000
-SELECT * FROM INFORMATION_SCHEMA.QUERY_RESPONSE_TIME;
-TIME COUNT TOTAL
+SHOW QUERY_RESPONSE_TIME;
+Time Count Total
0.000001 24 0.000000
0.001000 0 0.000000
1.000000 11 4.050000
diff --git a/plugin/query_response_time/plugin.cc b/plugin/query_response_time/plugin.cc
index 4012ad09d2b..c34e4cb6e02 100644
--- a/plugin/query_response_time/plugin.cc
+++ b/plugin/query_response_time/plugin.cc
@@ -72,9 +72,9 @@ static struct st_mysql_sys_var *query_response_time_info_vars[]=
ST_FIELD_INFO query_response_time_fields_info[] =
{
- { "TIME", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "", SKIP_OPEN_TABLE },
- { "COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "", SKIP_OPEN_TABLE },
- { "TOTAL", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "", SKIP_OPEN_TABLE },
+ { "TIME", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Time", 0 },
+ { "COUNT", MY_INT32_NUM_DECIMAL_DIGITS, MYSQL_TYPE_LONG, 0, MY_I_S_UNSIGNED, "Count", 0 },
+ { "TOTAL", QRT_TIME_STRING_LENGTH, MYSQL_TYPE_STRING, 0, 0, "Total", 0 },
{ 0, 0, MYSQL_TYPE_NULL, 0, 0, 0, 0 }
};
@@ -84,6 +84,7 @@ static int query_response_time_info_init(void *p)
ST_SCHEMA_TABLE *i_s_query_response_time= (ST_SCHEMA_TABLE *) p;
i_s_query_response_time->fields_info= query_response_time_fields_info;
i_s_query_response_time->fill_table= query_response_time_fill;
+ i_s_query_response_time->reset_table= query_response_time_flush;
query_response_time_init();
return 0;
}
diff --git a/plugin/query_response_time/query_response_time.cc b/plugin/query_response_time/query_response_time.cc
index b28962a5db4..7ea93515e4e 100644
--- a/plugin/query_response_time/query_response_time.cc
+++ b/plugin/query_response_time/query_response_time.cc
@@ -286,9 +286,10 @@ void query_response_time_free()
query_response_time::g_collector.flush();
}
-void query_response_time_flush()
+int query_response_time_flush()
{
query_response_time::g_collector.flush();
+ return 0;
}
void query_response_time_collect(ulonglong query_time)
{
diff --git a/plugin/query_response_time/query_response_time.h b/plugin/query_response_time/query_response_time.h
index 35b01b0db81..f59639f00a7 100644
--- a/plugin/query_response_time/query_response_time.h
+++ b/plugin/query_response_time/query_response_time.h
@@ -56,7 +56,7 @@ extern ST_SCHEMA_TABLE query_response_time_table;
#ifdef HAVE_RESPONSE_TIME_DISTRIBUTION
extern void query_response_time_init ();
extern void query_response_time_free ();
-extern void query_response_time_flush ();
+extern int query_response_time_flush ();
extern void query_response_time_collect(ulonglong query_time);
extern int query_response_time_fill (THD* thd, TABLE_LIST *tables, COND *cond);