Skip to content

Commit 6ee9cba

Browse files
author
Alexey Botchkov
committed
MDEV-10486 MariaDB 10.x does not update rows_examined in performance_schema tables.
Save the rows_examined counter before it gets emptied.
1 parent ef9e78c commit 6ee9cba

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,3 +118,19 @@ B
118118
select count(*) from events_statements_history where sql_text like "%...";
119119
count(*)
120120
2
121+
use test;
122+
create table t1 (id int);
123+
insert into t1 values (1), (2), (3);
124+
truncate performance_schema.events_statements_history;
125+
select * from t1;
126+
id
127+
1
128+
2
129+
3
130+
insert into t1 select RAND()*10000 from t1;
131+
select sql_text, rows_examined from performance_schema.events_statements_history;
132+
sql_text rows_examined
133+
truncate performance_schema.events_statements_history 0
134+
select * from t1 3
135+
insert into t1 select RAND()*10000 from t1 6
136+
drop table t1;

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

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,3 +207,18 @@ select 'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
207207
select _utf8mb4 'васÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑвасÑ' as B;
208208

209209
select count(*) from events_statements_history where sql_text like "%...";
210+
211+
212+
#
213+
# MDEV-10486 MariaDB 10.x does not update rows_examined in performance_schema tables
214+
# Verify that the rows_examined counter is set properly.
215+
216+
use test;
217+
create table t1 (id int);
218+
insert into t1 values (1), (2), (3);
219+
truncate performance_schema.events_statements_history;
220+
select * from t1;
221+
insert into t1 select RAND()*10000 from t1;
222+
select sql_text, rows_examined from performance_schema.events_statements_history;
223+
drop table t1;
224+

sql/sql_parse.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1957,11 +1957,12 @@ bool dispatch_command(enum enum_server_command command, THD *thd,
19571957

19581958
THD_STAGE_INFO(thd, stage_cleaning_up);
19591959
thd->reset_query();
1960-
thd->set_examined_row_count(0); // For processlist
1961-
thd->set_command(COM_SLEEP);
19621960

19631961
/* Performance Schema Interface instrumentation, end */
19641962
MYSQL_END_STATEMENT(thd->m_statement_psi, thd->get_stmt_da());
1963+
thd->set_examined_row_count(0); // For processlist
1964+
thd->set_command(COM_SLEEP);
1965+
19651966
thd->m_statement_psi= NULL;
19661967
thd->m_digest= NULL;
19671968

0 commit comments

Comments
 (0)