Fix MDEV-30820 problem found by Monty

This commit is contained in:
Oleksandr Byelkin 2023-11-01 11:56:24 +01:00
parent d5aff2d551
commit df93b4f259
4 changed files with 18 additions and 8 deletions

View file

@ -231,15 +231,18 @@ SET @old_dbug= @@GLOBAL.debug_dbug;
SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET GLOBAL debug_dbug="+d,debug_huge_number_of_examined_rows";
SET debug_dbug="+d,debug_huge_number_of_examined_rows";
SELECT * FROM tab_MDEV_30820 ORDER BY 1;
ID A
1 0
2 0
SET GLOBAL debug_dbug=@old_dbug;
SET debug_dbug=@old_dbug;
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
SELECT rows_examined, sql_text from mysql.slow_log where sql_text like "SELECT%FROM tab_MDEV_30820%";
rows_examined sql_text
18446744073708551615 SELECT * FROM tab_MDEV_30820 ORDER BY 1
drop table tab_MDEV_30820;
#
# End of 10.4 test

View file

@ -104,16 +104,21 @@ SET GLOBAL log_output= "TABLE";
SET GLOBAL slow_query_log= ON;
SET SESSION long_query_time= 0;
SET GLOBAL debug_dbug="+d,debug_huge_number_of_examined_rows";
SET debug_dbug="+d,debug_huge_number_of_examined_rows";
--disable_ps_protocol
--disable_view_protocol
SELECT * FROM tab_MDEV_30820 ORDER BY 1;
SET GLOBAL debug_dbug=@old_dbug;
--enable_view_protocol
--enable_ps_protocol
SET debug_dbug=@old_dbug;
## Reset to initial values
SET @@long_query_time= @old_long_query_time;
SET @@global.log_output= @old_log_output;
SET @@global.slow_query_log= @old_slow_query_log;
SELECT rows_examined, sql_text from mysql.slow_log where sql_text like "SELECT%FROM tab_MDEV_30820%";
drop table tab_MDEV_30820;
--echo #

View file

@ -5682,8 +5682,6 @@ void THD::set_examined_row_count(ha_rows count)
void THD::inc_sent_row_count(ha_rows count)
{
m_sent_row_count+= count;
DBUG_EXECUTE_IF("debug_huge_number_of_examined_rows",
m_examined_row_count= (ULONGLONG_MAX - 1000000););
MYSQL_SET_STATEMENT_ROWS_SENT(m_statement_psi, m_sent_row_count);
}

View file

@ -3013,7 +3013,11 @@ public:
{ return m_sent_row_count; }
ha_rows get_examined_row_count() const
{ return m_examined_row_count; }
{
DBUG_EXECUTE_IF("debug_huge_number_of_examined_rows",
return (ULONGLONG_MAX - 1000000););
return m_examined_row_count;
}
ulonglong get_affected_rows() const
{ return affected_rows; }