Skip to content

Commit 2ca4141

Browse files
committed
Merge branch 'merge-perfschema-5.6' into 10.0
2 parents 01be663 + 1b41eed commit 2ca4141

File tree

5 files changed

+75
-3
lines changed

5 files changed

+75
-3
lines changed

mysql-test/suite/perfschema/r/misc.result

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,3 +92,18 @@ object_schema object_name index_name count_fetch count_insert count_update count
9292
test t_60905 i 2 0 0 1
9393
test t_60905 NULL 5 5 0 1
9494
DROP TABLE t_60905;
95+
use test;
96+
truncate performance_schema.events_statements_history;
97+
truncate performance_schema.events_statements_history_long;
98+
select * from t1;
99+
ERROR 42S02: Table 'test.t1' doesn't exist
100+
101+
select mysql_errno, returned_sqlstate, message_text, errors, warnings
102+
from performance_schema.events_statements_history where errors > 0;
103+
mysql_errno returned_sqlstate message_text errors warnings
104+
1146 42S02 Table 'test.t1' doesn't exist 1 0
105+
106+
select mysql_errno, returned_sqlstate, message_text, errors, warnings from
107+
performance_schema.events_statements_history_long where errors > 0;
108+
mysql_errno returned_sqlstate message_text errors warnings
109+
1146 42S02 Table 'test.t1' doesn't exist 1 0

mysql-test/suite/perfschema/t/misc.test

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,23 @@ SELECT object_schema,
169169

170170
DROP TABLE t_60905;
171171

172+
173+
#
174+
# Bug#11929832 - EVENTS_STATEMENTS_HISTORY HAS ERRORS=0 WHEN THERE ARE ERRORS
175+
#
176+
# Verify that SQL errors are properly counted.
177+
178+
use test;
179+
truncate performance_schema.events_statements_history;
180+
truncate performance_schema.events_statements_history_long;
181+
182+
--error ER_NO_SUCH_TABLE
183+
select * from t1;
184+
185+
--echo
186+
select mysql_errno, returned_sqlstate, message_text, errors, warnings
187+
from performance_schema.events_statements_history where errors > 0;
188+
189+
--echo
190+
select mysql_errno, returned_sqlstate, message_text, errors, warnings from
191+
performance_schema.events_statements_history_long where errors > 0;

storage/perfschema/ha_perfschema.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ maria_declare_plugin(perfschema)
205205
0x0001,
206206
pfs_status_vars,
207207
NULL,
208-
"5.6.26",
208+
"5.6.27",
209209
MariaDB_PLUGIN_MATURITY_STABLE
210210
}
211211
maria_declare_plugin_end;

storage/perfschema/pfs.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4832,6 +4832,7 @@ static void end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
48324832
memcpy(pfs->m_message_text, da->message(), MYSQL_ERRMSG_SIZE);
48334833
pfs->m_message_text[MYSQL_ERRMSG_SIZE]= 0;
48344834
pfs->m_sql_errno= da->sql_errno();
4835+
pfs->m_error_count++;
48354836
memcpy(pfs->m_sqlstate, da->get_sqlstate(), SQLSTATE_LENGTH);
48364837
break;
48374838
case Diagnostics_area::DA_DISABLED:

storage/perfschema/pfs_timer.cc

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2012, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -124,6 +124,42 @@ void init_timers(void)
124124
Pick best replacements.
125125
*/
126126

127+
/*
128+
For WAIT, the cycle timer is used by default. However, it is not available
129+
on all architectures. Fall back to the nanosecond timer in this case. It is
130+
unlikely that neither cycle nor nanosecond are available, but we continue
131+
probing less resolution timers anyway for consistency with other events.
132+
*/
133+
134+
if (cycle_to_pico != 0)
135+
{
136+
/* Normal case. */
137+
wait_timer= TIMER_NAME_CYCLE;
138+
}
139+
else if (nanosec_to_pico != 0)
140+
{
141+
/* Robustness, no known cases. */
142+
wait_timer= TIMER_NAME_NANOSEC;
143+
}
144+
else if (microsec_to_pico != 0)
145+
{
146+
/* Robustness, no known cases. */
147+
wait_timer= TIMER_NAME_MICROSEC;
148+
}
149+
else if (millisec_to_pico != 0)
150+
{
151+
/* Robustness, no known cases. */
152+
wait_timer= TIMER_NAME_MILLISEC;
153+
}
154+
else
155+
{
156+
/*
157+
Will never be reached on any architecture, but must provide a default if
158+
no other timers are available.
159+
*/
160+
wait_timer= TIMER_NAME_TICK;
161+
}
162+
127163
/*
128164
For STAGE and STATEMENT, a timer with a fixed frequency is better.
129165
The prefered timer is nanosecond, or lower resolutions.
@@ -174,7 +210,7 @@ void init_timers(void)
174210
else if (millisec_to_pico != 0)
175211
{
176212
/* Robustness, no known cases. */
177-
idle_timer= TIMER_NAME_MILLISEC;
213+
wait_timer= TIMER_NAME_MILLISEC;
178214
}
179215
else if (tick_to_pico != 0)
180216
{

0 commit comments

Comments
 (0)