mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
- When find_all_keys() checks which table columns are needed for table scan that is done before the sorting, it should also analyze pushed index condition. This is achieved by remembering/checking pre-index-pushed condition.
This commit is contained in:
@ -437,3 +437,28 @@ NULL NULL 5678
|
||||
NULL NULL 5678
|
||||
set @@join_cache_level=@save_join_cache_level;
|
||||
drop table t0, t1;
|
||||
#
|
||||
# BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
|
||||
# (table->read_set, field_index))' on REPLACE ... SELECT with MRR
|
||||
#
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
create table t1 (
|
||||
key1 varchar(10),
|
||||
col1 char(255), col2 char(255),
|
||||
col3 char(244), col4 char(255),
|
||||
key(key1)
|
||||
);
|
||||
create table t2 like t1;
|
||||
insert into t1
|
||||
select
|
||||
1000+A.a+100*B.a + 10*C.a,
|
||||
'col1val', 'col2val',
|
||||
'col3val', 'col4val'
|
||||
from t0 A, t0 B, t0 C;
|
||||
REPLACE INTO t2(col2,col3,col4)
|
||||
SELECT col2,col3,col4
|
||||
FROM t1
|
||||
WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
|
||||
ORDER BY col1 LIMIT 7;
|
||||
drop table t0, t1, t2;
|
||||
|
@ -140,3 +140,32 @@ select * from t0, t1 where t0.a<=>t1.a;
|
||||
|
||||
set @@join_cache_level=@save_join_cache_level;
|
||||
drop table t0, t1;
|
||||
|
||||
--echo #
|
||||
--echo # BUG#625841: Assertion `!table || (!table->read_set || bitmap_is_set
|
||||
--echo # (table->read_set, field_index))' on REPLACE ... SELECT with MRR
|
||||
--echo #
|
||||
create table t0 (a int);
|
||||
insert into t0 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
create table t1 (
|
||||
key1 varchar(10),
|
||||
col1 char(255), col2 char(255),
|
||||
col3 char(244), col4 char(255),
|
||||
key(key1)
|
||||
);
|
||||
create table t2 like t1;
|
||||
|
||||
insert into t1
|
||||
select
|
||||
1000+A.a+100*B.a + 10*C.a,
|
||||
'col1val', 'col2val',
|
||||
'col3val', 'col4val'
|
||||
from t0 A, t0 B, t0 C;
|
||||
|
||||
REPLACE INTO t2(col2,col3,col4)
|
||||
SELECT col2,col3,col4
|
||||
FROM t1
|
||||
WHERE `key1` LIKE CONCAT( LEFT( '1' , 7 ) , '%' )
|
||||
ORDER BY col1 LIMIT 7;
|
||||
drop table t0, t1, t2;
|
||||
|
@ -542,11 +542,6 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
|
||||
current_thd->variables.read_buff_size);
|
||||
}
|
||||
|
||||
if (quick_select)
|
||||
{
|
||||
if (select->quick->reset())
|
||||
DBUG_RETURN(HA_POS_ERROR);
|
||||
}
|
||||
|
||||
/* Remember original bitmaps */
|
||||
save_read_set= sort_form->read_set;
|
||||
@ -559,8 +554,18 @@ static ha_rows find_all_keys(SORTPARAM *param, SQL_SELECT *select,
|
||||
if (select && select->cond)
|
||||
select->cond->walk(&Item::register_field_in_read_map, 1,
|
||||
(uchar*) sort_form);
|
||||
if (select && select->pre_idx_push_select_cond)
|
||||
select->pre_idx_push_select_cond->walk(&Item::register_field_in_read_map,
|
||||
1, (uchar*) sort_form);
|
||||
|
||||
sort_form->column_bitmaps_set(&sort_form->tmp_set, &sort_form->tmp_set);
|
||||
|
||||
if (quick_select)
|
||||
{
|
||||
if (select->quick->reset())
|
||||
DBUG_RETURN(HA_POS_ERROR);
|
||||
}
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (quick_select)
|
||||
|
@ -378,6 +378,7 @@ void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok)
|
||||
QT_ORDINARY););
|
||||
|
||||
tab->select->cond= tab->select_cond;
|
||||
tab->select->pre_idx_push_select_cond= tab->pre_idx_push_select_cond;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1119,7 +1119,7 @@ SQL_SELECT *make_select(TABLE *head, table_map const_tables,
|
||||
}
|
||||
|
||||
|
||||
SQL_SELECT::SQL_SELECT() :quick(0),cond(0),free_cond(0)
|
||||
SQL_SELECT::SQL_SELECT() :quick(0),cond(0),pre_idx_push_select_cond(NULL),free_cond(0)
|
||||
{
|
||||
quick_keys.clear_all(); needed_reg.clear_all();
|
||||
my_b_clear(&file);
|
||||
|
@ -738,6 +738,13 @@ class SQL_SELECT :public Sql_alloc {
|
||||
public:
|
||||
QUICK_SELECT_I *quick; // If quick-select used
|
||||
COND *cond; // where condition
|
||||
|
||||
/*
|
||||
When using Index Condition Pushdown: condition that we've had before
|
||||
extracting and pushing index condition.
|
||||
In other cases, NULL.
|
||||
*/
|
||||
Item *pre_idx_push_select_cond;
|
||||
TABLE *head;
|
||||
IO_CACHE file; // Positions to used records
|
||||
ha_rows records; // Records in use if read from file
|
||||
|
Reference in New Issue
Block a user