Skip to content

Commit b432c7b

Browse files
author
Jan Lindström
committed
MDEV-7133: InnoDB: Assertion failure in dict_tf_is_valid
Problem is that page compressed tables currently require atomic_blobs and that feature is not availabe currently for row_format=redundant. Fix: Disallow page compressed create option if table row_format=redundant.
1 parent 7bf391c commit b432c7b

File tree

4 files changed

+241
-0
lines changed

4 files changed

+241
-0
lines changed
Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,121 @@
1+
SET GLOBAL innodb_file_format = `Barracuda`;
2+
SET GLOBAL innodb_file_per_table = ON;
3+
set global innodb_compression_algorithm = 1;
4+
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
5+
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
6+
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
7+
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_compressed=1;
8+
ERROR HY000: Can't create table `test`.`innodb_compressed` (errno: 140 "Wrong create options")
9+
show warnings;
10+
Level Code Message
11+
Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=COMPRESSED
12+
Error 1005 Can't create table `test`.`innodb_compressed` (errno: 140 "Wrong create options")
13+
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
14+
show create table innodb_compact;
15+
Table Create Table
16+
innodb_compact CREATE TABLE `innodb_compact` (
17+
`c1` bigint(20) NOT NULL,
18+
`b` char(200) DEFAULT NULL
19+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1
20+
show create table innodb_dynamic;
21+
Table Create Table
22+
innodb_dynamic CREATE TABLE `innodb_dynamic` (
23+
`c1` bigint(20) NOT NULL,
24+
`b` char(200) DEFAULT NULL
25+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC `page_compressed`=1
26+
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_compressed=1;
27+
ERROR HY000: Can't create table `test`.`innodb_redundant` (errno: 140 "Wrong create options")
28+
show warnings;
29+
Level Code Message
30+
Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT
31+
Error 1005 Can't create table `test`.`innodb_redundant` (errno: 140 "Wrong create options")
32+
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
33+
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
34+
show create table innodb_redundant;
35+
Table Create Table
36+
innodb_redundant CREATE TABLE `innodb_redundant` (
37+
`c1` bigint(20) NOT NULL,
38+
`b` char(200) DEFAULT NULL
39+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
40+
alter table innodb_redundant page_compressed=1;
41+
ERROR HY000: Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
42+
show warnings;
43+
Level Code Message
44+
Warning 140 InnoDB: PAGE_COMPRESSED table can't have ROW_TYPE=REDUNDANT
45+
Error 1005 Can't create table `test`.`#sql-temporary` (errno: 140 "Wrong create options")
46+
Warning 1030 Got error 140 "Wrong create options" from storage engine InnoDB
47+
show create table innodb_redundant;
48+
Table Create Table
49+
innodb_redundant CREATE TABLE `innodb_redundant` (
50+
`c1` bigint(20) NOT NULL,
51+
`b` char(200) DEFAULT NULL
52+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=REDUNDANT
53+
alter table innodb_redundant row_format=compact page_compressed=1;
54+
show create table innodb_redundant;
55+
Table Create Table
56+
innodb_redundant CREATE TABLE `innodb_redundant` (
57+
`c1` bigint(20) NOT NULL,
58+
`b` char(200) DEFAULT NULL
59+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT `page_compressed`=1
60+
drop table innodb_redundant;
61+
create procedure innodb_insert_proc (repeat_count int)
62+
begin
63+
declare current_num int;
64+
set current_num = 0;
65+
while current_num < repeat_count do
66+
insert into innodb_normal values(current_num, substring(MD5(RAND()), -64));
67+
set current_num = current_num + 1;
68+
end while;
69+
end//
70+
commit;
71+
set autocommit=0;
72+
call innodb_insert_proc(5000);
73+
commit;
74+
set autocommit=1;
75+
insert into innodb_compact select * from innodb_normal;
76+
insert into innodb_dynamic select * from innodb_normal;
77+
update innodb_compact set c1 = c1 + 1;
78+
update innodb_dynamic set c1 = c1 + 1;
79+
select count(*) from innodb_compact where c1 < 1500000;
80+
count(*)
81+
5000
82+
select count(*) from innodb_dynamic where c1 < 1500000;
83+
count(*)
84+
5000
85+
update innodb_compact set c1 = c1 + 1;
86+
update innodb_dynamic set c1 = c1 + 1;
87+
select count(*) from innodb_compact where c1 < 1500000;
88+
count(*)
89+
5000
90+
select count(*) from innodb_dynamic where c1 < 1500000;
91+
count(*)
92+
5000
93+
SET GLOBAL innodb_file_format = `Barracuda`;
94+
SET GLOBAL innodb_file_per_table = ON;
95+
set global innodb_compression_algorithm = 0;
96+
alter table innodb_compact engine=innodb page_compressed=DEFAULT;
97+
alter table innodb_dynamic engine=innodb page_compressed=DEFAULT;
98+
show create table innodb_compact;
99+
Table Create Table
100+
innodb_compact CREATE TABLE `innodb_compact` (
101+
`c1` bigint(20) NOT NULL,
102+
`b` char(200) DEFAULT NULL
103+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=COMPACT
104+
show create table innodb_dynamic;
105+
Table Create Table
106+
innodb_dynamic CREATE TABLE `innodb_dynamic` (
107+
`c1` bigint(20) NOT NULL,
108+
`b` char(200) DEFAULT NULL
109+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 ROW_FORMAT=DYNAMIC
110+
update innodb_compact set c1 = c1 + 1;
111+
update innodb_dynamic set c1 = c1 + 1;
112+
select count(*) from innodb_compact where c1 < 1500000;
113+
count(*)
114+
5000
115+
select count(*) from innodb_dynamic where c1 < 1500000;
116+
count(*)
117+
5000
118+
drop procedure innodb_insert_proc;
119+
drop table innodb_normal;
120+
drop table innodb_compact;
121+
drop table innodb_dynamic;
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
-- source include/have_innodb.inc
2+
3+
--disable_query_log
4+
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
5+
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
6+
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
7+
--enable_query_log
8+
9+
SET GLOBAL innodb_file_format = `Barracuda`;
10+
SET GLOBAL innodb_file_per_table = ON;
11+
# zlib
12+
set global innodb_compression_algorithm = 1;
13+
14+
create table innodb_normal(c1 bigint not null, b char(200)) engine=innodb;
15+
create table innodb_compact(c1 bigint not null, b char(200)) engine=innodb row_format=compact page_compressed=1;
16+
create table innodb_dynamic(c1 bigint not null, b char(200)) engine=innodb row_format=dynamic page_compressed=1;
17+
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
18+
--error 1005
19+
create table innodb_compressed(c1 bigint not null, b char(200)) engine=innodb row_format=compressed page_compressed=1;
20+
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
21+
show warnings;
22+
show create table innodb_compact;
23+
show create table innodb_dynamic;
24+
25+
# MDEV-7133: InnoDB: Assertion failure in thread 140737091569408 in file dict0mem.cc line 74
26+
# InnoDB: Failing assertion: dict_tf_is_valid(flags)
27+
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
28+
--error 1005
29+
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant page_compressed=1;
30+
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
31+
show warnings;
32+
create table innodb_redundant(c1 bigint not null, b char(200)) engine=innodb row_format=redundant;
33+
show create table innodb_redundant;
34+
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
35+
--error 1005
36+
alter table innodb_redundant page_compressed=1;
37+
--replace_regex /#sql-[0-9a-f_]*`/#sql-temporary`/
38+
show warnings;
39+
show create table innodb_redundant;
40+
alter table innodb_redundant row_format=compact page_compressed=1;
41+
show create table innodb_redundant;
42+
drop table innodb_redundant;
43+
44+
delimiter //;
45+
create procedure innodb_insert_proc (repeat_count int)
46+
begin
47+
declare current_num int;
48+
set current_num = 0;
49+
while current_num < repeat_count do
50+
insert into innodb_normal values(current_num, substring(MD5(RAND()), -64));
51+
set current_num = current_num + 1;
52+
end while;
53+
end//
54+
delimiter ;//
55+
commit;
56+
57+
set autocommit=0;
58+
call innodb_insert_proc(5000);
59+
commit;
60+
set autocommit=1;
61+
62+
insert into innodb_compact select * from innodb_normal;
63+
insert into innodb_dynamic select * from innodb_normal;
64+
65+
update innodb_compact set c1 = c1 + 1;
66+
update innodb_dynamic set c1 = c1 + 1;
67+
select count(*) from innodb_compact where c1 < 1500000;
68+
select count(*) from innodb_dynamic where c1 < 1500000;
69+
70+
--source include/restart_mysqld.inc
71+
72+
update innodb_compact set c1 = c1 + 1;
73+
update innodb_dynamic set c1 = c1 + 1;
74+
select count(*) from innodb_compact where c1 < 1500000;
75+
select count(*) from innodb_dynamic where c1 < 1500000;
76+
77+
SET GLOBAL innodb_file_format = `Barracuda`;
78+
SET GLOBAL innodb_file_per_table = ON;
79+
# none
80+
set global innodb_compression_algorithm = 0;
81+
82+
alter table innodb_compact engine=innodb page_compressed=DEFAULT;
83+
alter table innodb_dynamic engine=innodb page_compressed=DEFAULT;
84+
show create table innodb_compact;
85+
show create table innodb_dynamic;
86+
87+
update innodb_compact set c1 = c1 + 1;
88+
update innodb_dynamic set c1 = c1 + 1;
89+
select count(*) from innodb_compact where c1 < 1500000;
90+
select count(*) from innodb_dynamic where c1 < 1500000;
91+
92+
drop procedure innodb_insert_proc;
93+
drop table innodb_normal;
94+
drop table innodb_compact;
95+
drop table innodb_dynamic;
96+
97+
# reset system
98+
--disable_query_log
99+
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
100+
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
101+
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
102+
--enable_query_log

storage/innobase/handler/ha_innodb.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11165,6 +11165,15 @@ ha_innobase::check_table_options(
1116511165
return "PAGE_COMPRESSED";
1116611166
}
1116711167

11168+
if (row_format == ROW_TYPE_REDUNDANT) {
11169+
push_warning(
11170+
thd, Sql_condition::WARN_LEVEL_WARN,
11171+
HA_WRONG_CREATE_OPTION,
11172+
"InnoDB: PAGE_COMPRESSED table can't have"
11173+
" ROW_TYPE=REDUNDANT");
11174+
return "PAGE_COMPRESSED";
11175+
}
11176+
1116811177
if (!use_tablespace) {
1116911178
push_warning(
1117011179
thd, Sql_condition::WARN_LEVEL_WARN,

storage/xtradb/handler/ha_innodb.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11797,6 +11797,15 @@ ha_innobase::check_table_options(
1179711797
return "PAGE_COMPRESSED";
1179811798
}
1179911799

11800+
if (row_format == ROW_TYPE_REDUNDANT) {
11801+
push_warning(
11802+
thd, Sql_condition::WARN_LEVEL_WARN,
11803+
HA_WRONG_CREATE_OPTION,
11804+
"InnoDB: PAGE_COMPRESSED table can't have"
11805+
" ROW_TYPE=REDUNDANT");
11806+
return "PAGE_COMPRESSED";
11807+
}
11808+
1180011809
if (!use_tablespace) {
1180111810
push_warning(
1180211811
thd, Sql_condition::WARN_LEVEL_WARN,

0 commit comments

Comments
 (0)