Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MDEV-33285 - Assertion `m_table' failed in ha_perfschema::rnd_end on CHECKSUM TABLE #3623

Open
wants to merge 1 commit into
base: 10.5
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions mysql-test/main/kill_debug.result
Original file line number Diff line number Diff line change
Expand Up @@ -237,3 +237,29 @@ kill $id;
set debug_sync='now SIGNAL go3';
drop table t1;
set debug_sync='reset';
#
# MDEV-33285 - Assertion `m_table' failed in ha_perfschema::rnd_end on
# CHECKSUM TABLE
#
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES(1);
SET debug_sync='mysql_checksum_table_after_calculate_checksum SIGNAL parked WAIT_FOR go';
CHECKSUM TABLE t1;
connect con1, localhost, root;
connection con1;
SET debug_sync='now WAIT_FOR parked';
KILL QUERY id;
SET debug_sync='now SIGNAL go';
connection default;
ERROR 70100: Query execution was interrupted
SET debug_sync='mysql_checksum_table_before_calculate_checksum SIGNAL parked WAIT_FOR go';
CHECKSUM TABLE t1;
connection con1;
SET debug_sync='now WAIT_FOR parked';
KILL QUERY id;
SET debug_sync='now SIGNAL go';
connection default;
ERROR 70100: Query execution was interrupted
DROP TABLE t1;
disconnect con1;
SET debug_sync='RESET';
36 changes: 36 additions & 0 deletions mysql-test/main/kill_debug.test
Original file line number Diff line number Diff line change
Expand Up @@ -316,3 +316,39 @@ evalp kill $id;
set debug_sync='now SIGNAL go3';
drop table t1;
set debug_sync='reset';


--echo #
--echo # MDEV-33285 - Assertion `m_table' failed in ha_perfschema::rnd_end on
--echo # CHECKSUM TABLE
--echo #
let $id= `select connection_id()`;
CREATE TABLE t1 (a INT);
INSERT INTO t1 VALUES(1);
SET debug_sync='mysql_checksum_table_after_calculate_checksum SIGNAL parked WAIT_FOR go';
send CHECKSUM TABLE t1;

connect con1, localhost, root;
connection con1;
SET debug_sync='now WAIT_FOR parked';
replace_result $id id;
eval KILL QUERY $id;
SET debug_sync='now SIGNAL go';
connection default;
error ER_QUERY_INTERRUPTED;
reap;

SET debug_sync='mysql_checksum_table_before_calculate_checksum SIGNAL parked WAIT_FOR go';
send CHECKSUM TABLE t1;
connection con1;
SET debug_sync='now WAIT_FOR parked';
replace_result $id id;
eval KILL QUERY $id;
SET debug_sync='now SIGNAL go';

connection default;
error ER_QUERY_INTERRUPTED;
reap;
DROP TABLE t1;
disconnect con1;
SET debug_sync='RESET';
5 changes: 4 additions & 1 deletion sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5604,7 +5604,10 @@ int handler::calculate_checksum()
for (;;)
{
if (thd->killed)
return HA_ERR_ABORTED_BY_USER;
{
error= HA_ERR_ABORTED_BY_USER;
break;
}

ha_checksum row_crc= 0;
error= ha_rnd_next(table->record[0]);
Expand Down
3 changes: 2 additions & 1 deletion sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12210,14 +12210,15 @@ bool mysql_checksum_table(THD *thd, TABLE_LIST *tables,
protocol->store_null();
else
{
DEBUG_SYNC(thd, "mysql_checksum_table_before_calculate_checksum");
int error= t->file->calculate_checksum();
DEBUG_SYNC(thd, "mysql_checksum_table_after_calculate_checksum");
if (thd->killed)
{
/*
we've been killed; let handler clean up, and remove the
partial current row from the recordset (embedded lib)
*/
t->file->ha_rnd_end();
thd->protocol->remove_last_row();
goto err;
}
Expand Down