Commit 171da6b3 authored by Daniel Black's avatar Daniel Black Committed by Sergei Petrunia

MDEV-22761: innodb row_search_idx_cond_check handle CHECK_ABORTED_BY_USER

handler_rowid_filter_check can return CHECK_ABORTED_BY_USER.

All the functions that call row_search_idx_cond_check handle the
CHECK_ABORTED_BY_USER return value. So return it rather than generating an
error.

This incorrect handling was introduced in MDEV-21794 (8d85715d).

Reviewer: Marko Mäkelä
parent 5896a498
set @save_optimizer_switch= @@optimizer_switch;
set @save_use_stat_tables= @@use_stat_tables;
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
set @@use_stat_tables=preferably;
set optimizer_use_condition_selectivity=2;
set optimizer_switch='rowid_filter=on';
#
# MDEV-22761 KILL QUERY during rowid_filter, crashes
#
CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
set debug_sync='row_search_pre_rowid_filter_check SIGNAL killme WAIT_FOR go';
SELECT * FROM t1 WHERE a > 0 AND b=0;
connect con1, localhost, root,,;
connection con1;
set debug_sync='now WAIT_FOR killme';
kill query @id;
set debug_sync='now SIGNAL go';
connection default;
a b
set debug_sync='RESET';
disconnect con1;
drop table t1;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @@optimizer_switch=@save_optimizer_switch;
set @@use_stat_tables=@save_use_stat_tables;
--source include/have_debug.inc
--source include/have_debug_sync.inc
--source include/have_innodb.inc
--source include/default_optimizer_switch.inc
--source include/count_sessions.inc
set @save_optimizer_switch= @@optimizer_switch;
set @save_use_stat_tables= @@use_stat_tables;
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
set @@use_stat_tables=preferably;
set optimizer_use_condition_selectivity=2;
set optimizer_switch='rowid_filter=on';
--echo #
--echo # MDEV-22761 KILL QUERY during rowid_filter, crashes
--echo #
CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
let $ID= `SELECT @id := CONNECTION_ID()`;
set debug_sync='row_search_pre_rowid_filter_check SIGNAL killme WAIT_FOR go';
send SELECT * FROM t1 WHERE a > 0 AND b=0;
connect (con1, localhost, root,,);
connection con1;
let $ignore= `SELECT @id := $ID`;
set debug_sync='now WAIT_FOR killme';
kill query @id;
set debug_sync='now SIGNAL go';
connection default;
reap;
set debug_sync='RESET';
disconnect con1;
drop table t1;
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
set @@optimizer_switch=@save_optimizer_switch;
set @@use_stat_tables=@save_use_stat_tables;
--source include/wait_until_count_sessions.inc
......@@ -184,6 +184,7 @@ main.rowid_filter : Modified in 10.4.13
main.rowid_filter_innodb : MDEV-20538 - Wrong result; modified in 10.4.13
main.rowid_filter_myisam : Added in 10.4.14
main.rpl_mysql_upgrade_slave_repo_check : Added in 10.4.13
main.rowid_filter_innodb_debug : MDEV-22761 - Added in 10.4.15
main.select : MDEV-20532 - Floating point differences
main.select_jcl6 : MDEV-20532 - Floating point differences
main.select_pkeycache : MDEV-20532 - Floating point differences
......
......@@ -3900,7 +3900,7 @@ row_sel_try_search_shortcut_for_mysql(
/*********************************************************************//**
Check a pushed-down index condition.
@return CHECK_NEG, CHECK_POS, or CHECK_OUT_OF_RANGE */
@return CHECK_ABORTED_BY_USER, CHECK_NEG, CHECK_POS, or CHECK_OUT_OF_RANGE */
static
check_result_t
row_search_idx_cond_check(
......@@ -3975,6 +3975,8 @@ row_search_idx_cond_check(
ut_ad(len == DATA_ROW_ID_LEN);
memcpy(prebuilt->row_id, data, DATA_ROW_ID_LEN);
}
DEBUG_SYNC_C("row_search_pre_rowid_filter_check");
result = handler_rowid_filter_check(prebuilt->pk_filter);
switch (result) {
case CHECK_NEG:
......@@ -3986,7 +3988,7 @@ row_search_idx_cond_check(
case CHECK_POS:
break;
default:
ut_error;
return(result);
}
}
/* Convert the remaining fields to MySQL format.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment