Skip to content

Commit 589a123

Browse files
committed
Merge 10.3 into 10.4
2 parents 77a245f + 39d8652 commit 589a123

22 files changed

+439
-46
lines changed

mysql-test/include/partition_mrr.inc

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
--source include/have_partition.inc
2+
3+
--disable_warnings
4+
drop table if exists t1,t3;
5+
--enable_warnings
6+
7+
--echo #
8+
--echo # MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error
9+
--echo #
10+
create table t1(a int);
11+
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
12+
13+
set @tmp=@@storage_engine;
14+
eval set storage_engine=$engine_type;
15+
16+
create table t3 (
17+
ID bigint(20) NOT NULL AUTO_INCREMENT,
18+
part_id int,
19+
key_col int,
20+
col2 int,
21+
key(key_col),
22+
PRIMARY KEY (ID,part_id)
23+
) PARTITION BY RANGE (part_id)
24+
(PARTITION p1 VALUES LESS THAN (3),
25+
PARTITION p2 VALUES LESS THAN (7),
26+
PARTITION p3 VALUES LESS THAN (10)
27+
);
28+
29+
show create table t3;
30+
set storage_engine= @tmp;
31+
32+
insert into t3 select
33+
A.a+10*B.a,
34+
A.a,
35+
B.a,
36+
123456
37+
from t1 A, t1 B;
38+
39+
set optimizer_switch='mrr=on';
40+
--replace_column 9 #
41+
explain
42+
select * from t3 force index (key_col) where key_col < 3;
43+
select * from t3 force index (key_col) where key_col < 3;
44+
45+
drop table t1,t3;
46+
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
drop table if exists t1,t3;
2+
#
3+
# MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error
4+
#
5+
create table t1(a int);
6+
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
7+
set @tmp=@@storage_engine;
8+
set storage_engine=Aria;
9+
create table t3 (
10+
ID bigint(20) NOT NULL AUTO_INCREMENT,
11+
part_id int,
12+
key_col int,
13+
col2 int,
14+
key(key_col),
15+
PRIMARY KEY (ID,part_id)
16+
) PARTITION BY RANGE (part_id)
17+
(PARTITION p1 VALUES LESS THAN (3),
18+
PARTITION p2 VALUES LESS THAN (7),
19+
PARTITION p3 VALUES LESS THAN (10)
20+
);
21+
show create table t3;
22+
Table Create Table
23+
t3 CREATE TABLE `t3` (
24+
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
25+
`part_id` int(11) NOT NULL,
26+
`key_col` int(11) DEFAULT NULL,
27+
`col2` int(11) DEFAULT NULL,
28+
PRIMARY KEY (`ID`,`part_id`),
29+
KEY `key_col` (`key_col`)
30+
) ENGINE=Aria DEFAULT CHARSET=latin1
31+
PARTITION BY RANGE (`part_id`)
32+
(PARTITION `p1` VALUES LESS THAN (3) ENGINE = Aria,
33+
PARTITION `p2` VALUES LESS THAN (7) ENGINE = Aria,
34+
PARTITION `p3` VALUES LESS THAN (10) ENGINE = Aria)
35+
set storage_engine= @tmp;
36+
insert into t3 select
37+
A.a+10*B.a,
38+
A.a,
39+
B.a,
40+
123456
41+
from t1 A, t1 B;
42+
set optimizer_switch='mrr=on';
43+
explain
44+
select * from t3 force index (key_col) where key_col < 3;
45+
id select_type table type possible_keys key key_len ref rows Extra
46+
1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan
47+
select * from t3 force index (key_col) where key_col < 3;
48+
ID part_id key_col col2
49+
1 0 0 123456
50+
1 1 0 123456
51+
2 2 0 123456
52+
10 0 1 123456
53+
11 1 1 123456
54+
12 2 1 123456
55+
20 0 2 123456
56+
21 1 2 123456
57+
22 2 2 123456
58+
3 3 0 123456
59+
4 4 0 123456
60+
5 5 0 123456
61+
6 6 0 123456
62+
13 3 1 123456
63+
14 4 1 123456
64+
15 5 1 123456
65+
16 6 1 123456
66+
23 3 2 123456
67+
24 4 2 123456
68+
25 5 2 123456
69+
26 6 2 123456
70+
7 7 0 123456
71+
8 8 0 123456
72+
9 9 0 123456
73+
17 7 1 123456
74+
18 8 1 123456
75+
19 9 1 123456
76+
27 7 2 123456
77+
28 8 2 123456
78+
29 9 2 123456
79+
drop table t1,t3;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
let $engine_type= Aria;
2+
--source include/partition_mrr.inc
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
drop table if exists t1,t3;
2+
#
3+
# MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error
4+
#
5+
create table t1(a int);
6+
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
7+
set @tmp=@@storage_engine;
8+
set storage_engine=InnoDB;
9+
create table t3 (
10+
ID bigint(20) NOT NULL AUTO_INCREMENT,
11+
part_id int,
12+
key_col int,
13+
col2 int,
14+
key(key_col),
15+
PRIMARY KEY (ID,part_id)
16+
) PARTITION BY RANGE (part_id)
17+
(PARTITION p1 VALUES LESS THAN (3),
18+
PARTITION p2 VALUES LESS THAN (7),
19+
PARTITION p3 VALUES LESS THAN (10)
20+
);
21+
show create table t3;
22+
Table Create Table
23+
t3 CREATE TABLE `t3` (
24+
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
25+
`part_id` int(11) NOT NULL,
26+
`key_col` int(11) DEFAULT NULL,
27+
`col2` int(11) DEFAULT NULL,
28+
PRIMARY KEY (`ID`,`part_id`),
29+
KEY `key_col` (`key_col`)
30+
) ENGINE=InnoDB DEFAULT CHARSET=latin1
31+
PARTITION BY RANGE (`part_id`)
32+
(PARTITION `p1` VALUES LESS THAN (3) ENGINE = InnoDB,
33+
PARTITION `p2` VALUES LESS THAN (7) ENGINE = InnoDB,
34+
PARTITION `p3` VALUES LESS THAN (10) ENGINE = InnoDB)
35+
set storage_engine= @tmp;
36+
insert into t3 select
37+
A.a+10*B.a,
38+
A.a,
39+
B.a,
40+
123456
41+
from t1 A, t1 B;
42+
set optimizer_switch='mrr=on';
43+
explain
44+
select * from t3 force index (key_col) where key_col < 3;
45+
id select_type table type possible_keys key key_len ref rows Extra
46+
1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan
47+
select * from t3 force index (key_col) where key_col < 3;
48+
ID part_id key_col col2
49+
1 0 0 123456
50+
1 1 0 123456
51+
2 2 0 123456
52+
10 0 1 123456
53+
11 1 1 123456
54+
12 2 1 123456
55+
20 0 2 123456
56+
21 1 2 123456
57+
22 2 2 123456
58+
3 3 0 123456
59+
4 4 0 123456
60+
5 5 0 123456
61+
6 6 0 123456
62+
13 3 1 123456
63+
14 4 1 123456
64+
15 5 1 123456
65+
16 6 1 123456
66+
23 3 2 123456
67+
24 4 2 123456
68+
25 5 2 123456
69+
26 6 2 123456
70+
7 7 0 123456
71+
8 8 0 123456
72+
9 9 0 123456
73+
17 7 1 123456
74+
18 8 1 123456
75+
19 9 1 123456
76+
27 7 2 123456
77+
28 8 2 123456
78+
29 9 2 123456
79+
drop table t1,t3;
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
--source include/have_innodb.inc
2+
let $engine_type= InnoDB;
3+
4+
--source include/partition_mrr.inc
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
drop table if exists t1,t3;
2+
#
3+
# MDEV-20611: MRR scan over partitioned InnoDB table produces "Out of memory" error
4+
#
5+
create table t1(a int);
6+
insert into t1 values (0),(1),(2),(3),(4),(5),(6),(7),(8),(9);
7+
set @tmp=@@storage_engine;
8+
set storage_engine=myisam;
9+
create table t3 (
10+
ID bigint(20) NOT NULL AUTO_INCREMENT,
11+
part_id int,
12+
key_col int,
13+
col2 int,
14+
key(key_col),
15+
PRIMARY KEY (ID,part_id)
16+
) PARTITION BY RANGE (part_id)
17+
(PARTITION p1 VALUES LESS THAN (3),
18+
PARTITION p2 VALUES LESS THAN (7),
19+
PARTITION p3 VALUES LESS THAN (10)
20+
);
21+
show create table t3;
22+
Table Create Table
23+
t3 CREATE TABLE `t3` (
24+
`ID` bigint(20) NOT NULL AUTO_INCREMENT,
25+
`part_id` int(11) NOT NULL,
26+
`key_col` int(11) DEFAULT NULL,
27+
`col2` int(11) DEFAULT NULL,
28+
PRIMARY KEY (`ID`,`part_id`),
29+
KEY `key_col` (`key_col`)
30+
) ENGINE=MyISAM DEFAULT CHARSET=latin1
31+
PARTITION BY RANGE (`part_id`)
32+
(PARTITION `p1` VALUES LESS THAN (3) ENGINE = MyISAM,
33+
PARTITION `p2` VALUES LESS THAN (7) ENGINE = MyISAM,
34+
PARTITION `p3` VALUES LESS THAN (10) ENGINE = MyISAM)
35+
set storage_engine= @tmp;
36+
insert into t3 select
37+
A.a+10*B.a,
38+
A.a,
39+
B.a,
40+
123456
41+
from t1 A, t1 B;
42+
set optimizer_switch='mrr=on';
43+
explain
44+
select * from t3 force index (key_col) where key_col < 3;
45+
id select_type table type possible_keys key key_len ref rows Extra
46+
1 SIMPLE t3 range key_col key_col 5 NULL # Using where; Rowid-ordered scan
47+
select * from t3 force index (key_col) where key_col < 3;
48+
ID part_id key_col col2
49+
1 0 0 123456
50+
1 1 0 123456
51+
2 2 0 123456
52+
10 0 1 123456
53+
11 1 1 123456
54+
12 2 1 123456
55+
20 0 2 123456
56+
21 1 2 123456
57+
22 2 2 123456
58+
3 3 0 123456
59+
4 4 0 123456
60+
5 5 0 123456
61+
6 6 0 123456
62+
13 3 1 123456
63+
14 4 1 123456
64+
15 5 1 123456
65+
16 6 1 123456
66+
23 3 2 123456
67+
24 4 2 123456
68+
25 5 2 123456
69+
26 6 2 123456
70+
7 7 0 123456
71+
8 8 0 123456
72+
9 9 0 123456
73+
17 7 1 123456
74+
18 8 1 123456
75+
19 9 1 123456
76+
27 7 2 123456
77+
28 8 2 123456
78+
29 9 2 123456
79+
drop table t1,t3;
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
let $engine_type= myisam;
2+
3+
--source include/partition_mrr.inc

mysql-test/suite/innodb/r/ibuf_not_empty.result

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1+
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
12
CREATE TABLE t1(
23
a INT AUTO_INCREMENT PRIMARY KEY,
34
b CHAR(1),
45
c INT,
56
INDEX(b))
67
ENGINE=InnoDB STATS_PERSISTENT=0;
78
SET GLOBAL innodb_change_buffering_debug = 1;
9+
BEGIN;
810
INSERT INTO t1 VALUES(0,'x',1);
911
INSERT INTO t1 SELECT 0,b,c FROM t1;
1012
INSERT INTO t1 SELECT 0,b,c FROM t1;
@@ -18,14 +20,14 @@ INSERT INTO t1 SELECT 0,b,c FROM t1;
1820
INSERT INTO t1 SELECT 0,b,c FROM t1;
1921
INSERT INTO t1 SELECT 0,b,c FROM t1;
2022
INSERT INTO t1 SELECT 0,b,c FROM t1;
23+
COMMIT;
24+
InnoDB 0 transactions not purged
2125
# restart: --innodb-force-recovery=6 --innodb-change-buffer-dump
2226
check table t1;
2327
Table Op Msg_type Msg_text
2428
test.t1 check Warning InnoDB: Index 'b' contains #### entries, should be 4096.
2529
test.t1 check error Corrupt
2630
# restart
27-
SET GLOBAL innodb_purge_rseg_truncate_frequency=1;
28-
InnoDB 0 transactions not purged
2931
SET GLOBAL innodb_fast_shutdown=0;
3032
# restart
3133
DROP TABLE t1;

0 commit comments

Comments
 (0)