Skip to content

Commit 8d210fc

Browse files
spetruniasanja-byelkin
authored andcommitted
MDEV-31877: ASAN errors in Exec_time_tracker::get_cycles with innodb slow log verbosity
Remove redundant delete_explain_query() calls in sp_instr_set::exec_core(), sp_instr_set_row_field::exec_core(), sp_instr_set_row_field_by_name::exec_core(). These calls are made before the SP instruction's tables are "closed" by close_thread_tables() call. When we call close_thread_tables() after that, we no longer can collect engine's counter variables, as they use the data structures that are located in the Explain Data Structures. Also, these delete_explain_query() calls are redundant, as sp_lex_keeper::reset_lex_and_exec_core() has another delete_explain_query() call, which is located in the right location after the close_thread_tables() call.
1 parent d28d636 commit 8d210fc

File tree

3 files changed

+28
-3
lines changed

3 files changed

+28
-3
lines changed

mysql-test/main/sp.result

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8972,3 +8972,15 @@ select @counter;
89728972
5
89738973
drop function f1;
89748974
drop table t1,t2;
8975+
#
8976+
# MDEV-31877: ASAN errors in Exec_time_tracker::get_cycles with innodb slow log verbosity
8977+
#
8978+
CREATE TABLE t1 (a INT, b INT);
8979+
INSERT INTO t1 VALUES (1,2);
8980+
SET @tmp=@@log_slow_verbosity;
8981+
SET SESSION log_slow_verbosity= 'innodb';
8982+
BEGIN NOT ATOMIC DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1); SELECT r.a; END $
8983+
r.a
8984+
1
8985+
SET SESSION log_slow_verbosity= @tmp;
8986+
DROP TABLE t1;

mysql-test/main/sp.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10573,3 +10573,19 @@ select f1(col1) from t2 order by col2 desc limit 5;
1057310573
select @counter;
1057410574
drop function f1;
1057510575
drop table t1,t2;
10576+
10577+
--echo #
10578+
--echo # MDEV-31877: ASAN errors in Exec_time_tracker::get_cycles with innodb slow log verbosity
10579+
--echo #
10580+
CREATE TABLE t1 (a INT, b INT);
10581+
INSERT INTO t1 VALUES (1,2);
10582+
SET @tmp=@@log_slow_verbosity;
10583+
SET SESSION log_slow_verbosity= 'innodb';
10584+
--delimiter $
10585+
BEGIN NOT ATOMIC DECLARE r ROW TYPE OF t1 DEFAULT (SELECT * FROM t1); SELECT r.a; END $
10586+
--delimiter ;
10587+
10588+
SET SESSION log_slow_verbosity= @tmp;
10589+
# Cleanup
10590+
DROP TABLE t1;
10591+

sql/sp_head.cc

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3807,7 +3807,6 @@ int
38073807
sp_instr_set::exec_core(THD *thd, uint *nextp)
38083808
{
38093809
int res= get_rcontext(thd)->set_variable(thd, m_offset, &m_value);
3810-
delete_explain_query(thd->lex);
38113810
*nextp = m_ip+1;
38123811
return res;
38133812
}
@@ -3849,7 +3848,6 @@ sp_instr_set_row_field::exec_core(THD *thd, uint *nextp)
38493848
int res= get_rcontext(thd)->set_variable_row_field(thd, m_offset,
38503849
m_field_offset,
38513850
&m_value);
3852-
delete_explain_query(thd->lex);
38533851
*nextp= m_ip + 1;
38543852
return res;
38553853
}
@@ -3897,7 +3895,6 @@ sp_instr_set_row_field_by_name::exec_core(THD *thd, uint *nextp)
38973895
int res= get_rcontext(thd)->set_variable_row_field_by_name(thd, m_offset,
38983896
m_field_name,
38993897
&m_value);
3900-
delete_explain_query(thd->lex);
39013898
*nextp= m_ip + 1;
39023899
return res;
39033900
}

0 commit comments

Comments
 (0)