summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergei Golubchik <serg@mariadb.org>2015-10-09 17:22:53 +0200
committerSergei Golubchik <serg@mariadb.org>2015-10-09 17:22:53 +0200
commit1b41eed5d178182e7d9070450178188ca1e47265 (patch)
tree51b0d76cfb69882b431666b4b187c9445e1dff34
parent167c540048ed1c49fa97f86cadba1e7ff0559d12 (diff)
downloadmariadb-git-1b41eed5d178182e7d9070450178188ca1e47265.tar.gz
5.6.27
-rw-r--r--mysql-test/suite/perfschema/r/misc.result15
-rw-r--r--mysql-test/suite/perfschema/r/query_cache.result4
-rw-r--r--mysql-test/suite/perfschema/t/misc.test20
-rw-r--r--mysql-test/suite/perfschema/t/query_cache.test2
-rw-r--r--storage/perfschema/pfs.cc1
-rw-r--r--storage/perfschema/pfs_timer.cc40
6 files changed, 78 insertions, 4 deletions
diff --git a/mysql-test/suite/perfschema/r/misc.result b/mysql-test/suite/perfschema/r/misc.result
index fd8f93c129f..24cf4cc749a 100644
--- a/mysql-test/suite/perfschema/r/misc.result
+++ b/mysql-test/suite/perfschema/r/misc.result
@@ -92,3 +92,18 @@ object_schema object_name index_name count_fetch count_insert count_update count
test t_60905 i 2 0 0 1
test t_60905 NULL 5 5 0 1
DROP TABLE t_60905;
+use test;
+truncate performance_schema.events_statements_history;
+truncate performance_schema.events_statements_history_long;
+select * from t1;
+ERROR 42S02: Table 'test.t1' doesn't exist
+
+select mysql_errno, returned_sqlstate, message_text, errors, warnings
+from performance_schema.events_statements_history where errors > 0;
+mysql_errno returned_sqlstate message_text errors warnings
+1146 42S02 Table 'test.t1' doesn't exist 1 0
+
+select mysql_errno, returned_sqlstate, message_text, errors, warnings from
+performance_schema.events_statements_history_long where errors > 0;
+mysql_errno returned_sqlstate message_text errors warnings
+1146 42S02 Table 'test.t1' doesn't exist 1 0
diff --git a/mysql-test/suite/perfschema/r/query_cache.result b/mysql-test/suite/perfschema/r/query_cache.result
index 8786cd055ca..837c2573a72 100644
--- a/mysql-test/suite/perfschema/r/query_cache.result
+++ b/mysql-test/suite/perfschema/r/query_cache.result
@@ -38,7 +38,7 @@ spins
NULL
select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME
-wait CYCLE
+wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
@@ -53,7 +53,7 @@ spins
NULL
select * from performance_schema.setup_timers where name='wait';
NAME TIMER_NAME
-wait CYCLE
+wait {CYCLE_OR_NANOSECOND}
show status like "Qcache_queries_in_cache";
Variable_name Value
Qcache_queries_in_cache 1
diff --git a/mysql-test/suite/perfschema/t/misc.test b/mysql-test/suite/perfschema/t/misc.test
index b7e714a6271..d6c302c29bf 100644
--- a/mysql-test/suite/perfschema/t/misc.test
+++ b/mysql-test/suite/perfschema/t/misc.test
@@ -168,3 +168,23 @@ SELECT object_schema,
DROP TABLE t_60905;
+
+#
+# Bug#11929832 - EVENTS_STATEMENTS_HISTORY HAS ERRORS=0 WHEN THERE ARE ERRORS
+#
+# Verify that SQL errors are properly counted.
+
+use test;
+truncate performance_schema.events_statements_history;
+truncate performance_schema.events_statements_history_long;
+
+--error ER_NO_SUCH_TABLE
+select * from t1;
+
+--echo
+select mysql_errno, returned_sqlstate, message_text, errors, warnings
+ from performance_schema.events_statements_history where errors > 0;
+
+--echo
+select mysql_errno, returned_sqlstate, message_text, errors, warnings from
+ performance_schema.events_statements_history_long where errors > 0;
diff --git a/mysql-test/suite/perfschema/t/query_cache.test b/mysql-test/suite/perfschema/t/query_cache.test
index 60d4a648222..802e574f89b 100644
--- a/mysql-test/suite/perfschema/t/query_cache.test
+++ b/mysql-test/suite/perfschema/t/query_cache.test
@@ -34,6 +34,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
+--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
@@ -42,6 +43,7 @@ show status like "Qcache_hits";
select spins from performance_schema.events_waits_current order by event_name limit 1;
+--replace_result CYCLE {CYCLE_OR_NANOSECOND} NANOSECOND {CYCLE_OR_NANOSECOND}
select * from performance_schema.setup_timers where name='wait';
show status like "Qcache_queries_in_cache";
diff --git a/storage/perfschema/pfs.cc b/storage/perfschema/pfs.cc
index 7c556ba4407..6e6f8dcb1c4 100644
--- a/storage/perfschema/pfs.cc
+++ b/storage/perfschema/pfs.cc
@@ -4832,6 +4832,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
memcpy(pfs->m_message_text, da->message(), MYSQL_ERRMSG_SIZE);
pfs->m_message_text[MYSQL_ERRMSG_SIZE]= 0;
pfs->m_sql_errno= da->sql_errno();
+ pfs->m_error_count++;
memcpy(pfs->m_sqlstate, da->get_sqlstate(), SQLSTATE_LENGTH);
break;
case Diagnostics_area::DA_DISABLED:
diff --git a/storage/perfschema/pfs_timer.cc b/storage/perfschema/pfs_timer.cc
index 8c3553db2b2..8348f165e5c 100644
--- a/storage/perfschema/pfs_timer.cc
+++ b/storage/perfschema/pfs_timer.cc
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -125,6 +125,42 @@ void init_timers(void)
*/
/*
+ For WAIT, the cycle timer is used by default. However, it is not available
+ on all architectures. Fall back to the nanosecond timer in this case. It is
+ unlikely that neither cycle nor nanosecond are available, but we continue
+ probing less resolution timers anyway for consistency with other events.
+ */
+
+ if (cycle_to_pico != 0)
+ {
+ /* Normal case. */
+ wait_timer= TIMER_NAME_CYCLE;
+ }
+ else if (nanosec_to_pico != 0)
+ {
+ /* Robustness, no known cases. */
+ wait_timer= TIMER_NAME_NANOSEC;
+ }
+ else if (microsec_to_pico != 0)
+ {
+ /* Robustness, no known cases. */
+ wait_timer= TIMER_NAME_MICROSEC;
+ }
+ else if (millisec_to_pico != 0)
+ {
+ /* Robustness, no known cases. */
+ wait_timer= TIMER_NAME_MILLISEC;
+ }
+ else
+ {
+ /*
+ Will never be reached on any architecture, but must provide a default if
+ no other timers are available.
+ */
+ wait_timer= TIMER_NAME_TICK;
+ }
+
+ /*
For STAGE and STATEMENT, a timer with a fixed frequency is better.
The prefered timer is nanosecond, or lower resolutions.
*/
@@ -174,7 +210,7 @@ void init_timers(void)
else if (millisec_to_pico != 0)
{
/* Robustness, no known cases. */
- idle_timer= TIMER_NAME_MILLISEC;
+ wait_timer= TIMER_NAME_MILLISEC;
}
else if (tick_to_pico != 0)
{