Skip to content

Commit 7eda2af

Browse files
author
Christopher Powers
committed
Merge branch 'mysql-5.6' into mysql-5.7
Conflicts: mysql-test/suite/perfschema/r/misc.result mysql-test/suite/perfschema/t/misc.test storage/perfschema/pfs.cc
2 parents eac8249 + d7b0c4f commit 7eda2af

File tree

3 files changed

+36
-0
lines changed

3 files changed

+36
-0
lines changed

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,3 +108,18 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
108108
show events where Db= 'performance_schema';
109109
Db Name Definer Time zone Type Execute at Interval value Interval field Starts Ends Status Originator character_set_client collation_connection Database Collation
110110
use test;
111+
use test;
112+
truncate performance_schema.events_statements_history;
113+
truncate performance_schema.events_statements_history_long;
114+
select * from t1;
115+
ERROR 42S02: Table 'test.t1' doesn't exist
116+
117+
select sql_text, mysql_errno, returned_sqlstate, message_text, errors, warnings
118+
from performance_schema.events_statements_history where errors > 0;
119+
sql_text mysql_errno returned_sqlstate message_text errors warnings
120+
select * from t1 1146 42S02 Table 'test.t1' doesn't exist 1 0
121+
122+
select sql_text, mysql_errno, returned_sqlstate, message_text, errors, warnings from
123+
performance_schema.events_statements_history_long where errors > 0;
124+
sql_text mysql_errno returned_sqlstate message_text errors warnings
125+
select * from t1 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
@@ -185,3 +185,23 @@ show events from performance_schema;
185185
show events where Db= 'performance_schema';
186186
use test;
187187

188+
189+
#
190+
# Bug#11929832 - EVENTS_STATEMENTS_HISTORY HAS ERRORS=0 WHEN THERE ARE ERRORS
191+
#
192+
# Verify that SQL errors are properly counted.
193+
194+
use test;
195+
truncate performance_schema.events_statements_history;
196+
truncate performance_schema.events_statements_history_long;
197+
198+
--error ER_NO_SUCH_TABLE
199+
select * from t1;
200+
201+
--echo
202+
select sql_text, mysql_errno, returned_sqlstate, message_text, errors, warnings
203+
from performance_schema.events_statements_history where errors > 0;
204+
205+
--echo
206+
select sql_text, mysql_errno, returned_sqlstate, message_text, errors, warnings from
207+
performance_schema.events_statements_history_long where errors > 0;

storage/perfschema/pfs.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5346,6 +5346,7 @@ void pfs_end_statement_v1(PSI_statement_locker *locker, void *stmt_da)
53465346
pfs->m_message_text[MYSQL_ERRMSG_SIZE]= 0;
53475347
pfs->m_sql_errno= da->mysql_errno();
53485348
memcpy(pfs->m_sqlstate, da->returned_sqlstate(), SQLSTATE_LENGTH);
5349+
pfs->m_error_count++;
53495350
break;
53505351
case Diagnostics_area::DA_DISABLED:
53515352
break;

0 commit comments

Comments
 (0)