mirror of
https://github.com/MariaDB/server.git
synced 2025-07-29 05:21:33 +03:00
MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error
Fix partitioning and DS-MRR to work together - In ha_partition::index_end(): take into account that ha_innobase (and other engines using DS-MRR) will have inited=RND when initialized for DS-MRR scan. - In ha_partition::multi_range_read_next(): if the MRR scan is using HA_MRR_NO_ASSOCIATION mode, it is not guaranteed that the partition's handler will store anything into *range_info. - In DsMrr_impl::choose_mrr_impl(): ha_partition will inquire partitions about how much memory their MRR implementation needs by passing *buffer_size=0. DS-MRR code didn't know about this (actually it used uint for buffer size calculation and would have an under-flow). Returning *buffer_size=0 made ha_partition assume that partitions do not need MRR memory and pass the same buffer to each of them. Now, this is fixed. If DS-MRR gets *buffer_size=0, it will return the amount of buffer space needed, but not more than about @@mrr_buffer_size. * Fix ha_{innobase,maria,myisam}::clone. If ha_partition uses MRR on its partitions, and partition use DS-MRR, the code will call handler->clone with TABLE (*NOT partition*) name as an argument. DS-MRR has no way of knowing the partition name, so the solution was to have the ::clone() function for the affected storage engine to ignore the name argument and get it elsewhere.
This commit is contained in:
46
mysql-test/include/partition_mrr.inc
Normal file
46
mysql-test/include/partition_mrr.inc
Normal file
@ -0,0 +1,46 @@
|
||||
--source include/have_partition.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1,t3;
|
||||
--enable_warnings
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error
|
||||
--echo #
|
||||
create table t1(a int);
|
||||
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
|
||||
|
||||
set @tmp=@@storage_engine;
|
||||
eval set storage_engine=$engine_type;
|
||||
|
||||
create table t3 (
|
||||
ID bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
part_id int,
|
||||
key_col int,
|
||||
col2 int,
|
||||
key(key_col),
|
||||
PRIMARY KEY (ID,part_id)
|
||||
) PARTITION BY RANGE (part_id)
|
||||
(PARTITION p1 VALUES LESS THAN (3),
|
||||
PARTITION p2 VALUES LESS THAN (7),
|
||||
PARTITION p3 VALUES LESS THAN (10)
|
||||
);
|
||||
|
||||
show create table t3;
|
||||
set storage_engine= @tmp;
|
||||
|
||||
insert into t3 select
|
||||
A.a+10*B.a,
|
||||
A.a,
|
||||
B.a,
|
||||
123456
|
||||
from t1 A, t1 B;
|
||||
|
||||
set optimizer_switch='mrr=on';
|
||||
--replace_column 9 #
|
||||
explain
|
||||
select * from t3 force index (key_col) where key_col < 3;
|
||||
select * from t3 force index (key_col) where key_col < 3;
|
||||
|
||||
drop table t1,t3;
|
||||
|
Reference in New Issue
Block a user