Skip to content

Commit dbc79ce

Browse files
author
Jan Lindström
committed
MDEV-6354: Implement a way to read MySQL 5.7.4-labs-tplc page
compression format (Fusion-IO). Addeed LZMA and BZIP2 compression methods.
1 parent f98b52a commit dbc79ce

34 files changed

+2704
-1095
lines changed

cmake/bzip2.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
2+
#
3+
# This program is free software; you can redistribute it and/or modify it under
4+
# the terms of the GNU General Public License as published by the Free Software
5+
# Foundation; version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful, but WITHOUT
8+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
10+
#
11+
# You should have received a copy of the GNU General Public License along with
12+
# this program; if not, write to the Free Software Foundation, Inc.,
13+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14+
15+
MACRO (MYSQL_CHECK_BZIP2)
16+
17+
CHECK_INCLUDE_FILES(bzlib.h HAVE_BZLIB2_H)
18+
CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffCompress "" HAVE_BZLIB2_COMPRESS)
19+
CHECK_LIBRARY_EXISTS(bz2 BZ2_bzBuffToBuffDecompress "" HAVE_BZLIB2_DECOMPRESS)
20+
21+
IF (HAVE_BZLIB2_COMPRESS AND HAVE_BZLIB2_DECOMPRESS AND HAVE_BZLIB2_H)
22+
ADD_DEFINITIONS(-DHAVE_BZIP2=1)
23+
LINK_LIBRARIES(bz2)
24+
ENDIF()
25+
ENDMACRO()

cmake/lzma.cmake

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright (C) 2014, SkySQL Ab. All Rights Reserved.
2+
#
3+
# This program is free software; you can redistribute it and/or modify it under
4+
# the terms of the GNU General Public License as published by the Free Software
5+
# Foundation; version 2 of the License.
6+
#
7+
# This program is distributed in the hope that it will be useful, but WITHOUT
8+
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
9+
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
10+
#
11+
# You should have received a copy of the GNU General Public License along with
12+
# this program; if not, write to the Free Software Foundation, Inc.,
13+
# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
14+
15+
MACRO (MYSQL_CHECK_LZMA)
16+
17+
CHECK_INCLUDE_FILES(lzma.h HAVE_LZMA_H)
18+
CHECK_LIBRARY_EXISTS(lzma lzma_stream_buffer_decode "" HAVE_LZMA_DECODE)
19+
CHECK_LIBRARY_EXISTS(lzma lzma_easy_buffer_encode "" HAVE_LZMA_ENCODE)
20+
21+
IF (HAVE_LZMA_DECODE AND HAVE_LZMA_ENCODE AND HAVE_LZMA_H)
22+
ADD_DEFINITIONS(-DHAVE_LZMA=1)
23+
LINK_LIBRARIES(lzma)
24+
ENDIF()
25+
ENDMACRO()
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if (! `SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_bzip2' AND variable_value = 'ON'`)
2+
{
3+
--skip Test requires InnoDB compiled with libbz2
4+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lz4' AND variable_value = 1`)
1+
if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lz4' AND variable_value = 'ON'`)
22
{
33
--skip Test requires InnoDB compiled with liblz4
44
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
if (!`SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lzma' AND variable_value = 'ON' `)
2+
{
3+
--skip Test requires InnoDB compiled with liblzma
4+
}
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lzo' AND variable_value = 1`)
1+
if (! `SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lzo' AND variable_value = 'ON'`)
22
{
33
--skip Test requires InnoDB compiled with liblzo
44
}
Lines changed: 269 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,269 @@
1+
set global innodb_file_format = `barracuda`;
2+
set global innodb_file_per_table = on;
3+
set global innodb_compression_algorithm = 5;
4+
create table innodb_compressed(c1 int, b char(20)) engine=innodb row_format=compressed key_block_size=8;
5+
show warnings;
6+
Level Code Message
7+
create table innodb_normal (c1 int, b char(20)) engine=innodb;
8+
show warnings;
9+
Level Code Message
10+
create table innodb_page_compressed1 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=1;
11+
show warnings;
12+
Level Code Message
13+
show create table innodb_page_compressed1;
14+
Table Create Table
15+
innodb_page_compressed1 CREATE TABLE `innodb_page_compressed1` (
16+
`c1` int(11) DEFAULT NULL,
17+
`b` char(20) DEFAULT NULL
18+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=1
19+
create table innodb_page_compressed2 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=2;
20+
show warnings;
21+
Level Code Message
22+
show create table innodb_page_compressed2;
23+
Table Create Table
24+
innodb_page_compressed2 CREATE TABLE `innodb_page_compressed2` (
25+
`c1` int(11) DEFAULT NULL,
26+
`b` char(20) DEFAULT NULL
27+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=2
28+
create table innodb_page_compressed3 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=3;
29+
show warnings;
30+
Level Code Message
31+
show create table innodb_page_compressed3;
32+
Table Create Table
33+
innodb_page_compressed3 CREATE TABLE `innodb_page_compressed3` (
34+
`c1` int(11) DEFAULT NULL,
35+
`b` char(20) DEFAULT NULL
36+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=3
37+
create table innodb_page_compressed4 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=4;
38+
show warnings;
39+
Level Code Message
40+
show create table innodb_page_compressed4;
41+
Table Create Table
42+
innodb_page_compressed4 CREATE TABLE `innodb_page_compressed4` (
43+
`c1` int(11) DEFAULT NULL,
44+
`b` char(20) DEFAULT NULL
45+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=4
46+
create table innodb_page_compressed5 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=5;
47+
show warnings;
48+
Level Code Message
49+
show create table innodb_page_compressed5;
50+
Table Create Table
51+
innodb_page_compressed5 CREATE TABLE `innodb_page_compressed5` (
52+
`c1` int(11) DEFAULT NULL,
53+
`b` char(20) DEFAULT NULL
54+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=5
55+
create table innodb_page_compressed6 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=6;
56+
show warnings;
57+
Level Code Message
58+
show create table innodb_page_compressed6;
59+
Table Create Table
60+
innodb_page_compressed6 CREATE TABLE `innodb_page_compressed6` (
61+
`c1` int(11) DEFAULT NULL,
62+
`b` char(20) DEFAULT NULL
63+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=6
64+
create table innodb_page_compressed7 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=7;
65+
show warnings;
66+
Level Code Message
67+
show create table innodb_page_compressed7;
68+
Table Create Table
69+
innodb_page_compressed7 CREATE TABLE `innodb_page_compressed7` (
70+
`c1` int(11) DEFAULT NULL,
71+
`b` char(20) DEFAULT NULL
72+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=7
73+
create table innodb_page_compressed8 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=8;
74+
show warnings;
75+
Level Code Message
76+
show create table innodb_page_compressed8;
77+
Table Create Table
78+
innodb_page_compressed8 CREATE TABLE `innodb_page_compressed8` (
79+
`c1` int(11) DEFAULT NULL,
80+
`b` char(20) DEFAULT NULL
81+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
82+
create table innodb_page_compressed9 (c1 int, b char(20)) engine=innodb page_compressed=1 page_compression_level=9;
83+
show warnings;
84+
Level Code Message
85+
show create table innodb_page_compressed9;
86+
Table Create Table
87+
innodb_page_compressed9 CREATE TABLE `innodb_page_compressed9` (
88+
`c1` int(11) DEFAULT NULL,
89+
`b` char(20) DEFAULT NULL
90+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=9
91+
create procedure innodb_insert_proc (repeat_count int)
92+
begin
93+
declare current_num int;
94+
set current_num = 0;
95+
while current_num < repeat_count do
96+
insert into innodb_normal values(current_num,'testing..');
97+
set current_num = current_num + 1;
98+
end while;
99+
end//
100+
commit;
101+
set autocommit=0;
102+
call innodb_insert_proc(5000);
103+
commit;
104+
set autocommit=1;
105+
select count(*) from innodb_normal;
106+
count(*)
107+
5000
108+
insert into innodb_compressed select * from innodb_normal;
109+
insert into innodb_page_compressed1 select * from innodb_normal;
110+
insert into innodb_page_compressed2 select * from innodb_normal;
111+
insert into innodb_page_compressed3 select * from innodb_normal;
112+
insert into innodb_page_compressed4 select * from innodb_normal;
113+
insert into innodb_page_compressed5 select * from innodb_normal;
114+
insert into innodb_page_compressed6 select * from innodb_normal;
115+
insert into innodb_page_compressed7 select * from innodb_normal;
116+
insert into innodb_page_compressed8 select * from innodb_normal;
117+
insert into innodb_page_compressed9 select * from innodb_normal;
118+
commit;
119+
select count(*) from innodb_compressed;
120+
count(*)
121+
5000
122+
select count(*) from innodb_page_compressed1;
123+
count(*)
124+
5000
125+
select count(*) from innodb_page_compressed1 where c1 < 500000;
126+
count(*)
127+
5000
128+
select count(*) from innodb_page_compressed2 where c1 < 500000;
129+
count(*)
130+
5000
131+
select count(*) from innodb_page_compressed3 where c1 < 500000;
132+
count(*)
133+
5000
134+
select count(*) from innodb_page_compressed4 where c1 < 500000;
135+
count(*)
136+
5000
137+
select count(*) from innodb_page_compressed5 where c1 < 500000;
138+
count(*)
139+
5000
140+
select count(*) from innodb_page_compressed6 where c1 < 500000;
141+
count(*)
142+
5000
143+
select count(*) from innodb_page_compressed7 where c1 < 500000;
144+
count(*)
145+
5000
146+
select count(*) from innodb_page_compressed8 where c1 < 500000;
147+
count(*)
148+
5000
149+
select count(*) from innodb_page_compressed9 where c1 < 500000;
150+
count(*)
151+
5000
152+
alter table innodb_normal page_compressed=1 page_compression_level=8;
153+
show warnings;
154+
Level Code Message
155+
show create table innodb_normal;
156+
Table Create Table
157+
innodb_normal CREATE TABLE `innodb_normal` (
158+
`c1` int(11) DEFAULT NULL,
159+
`b` char(20) DEFAULT NULL
160+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
161+
alter table innodb_compressed row_format=default page_compressed=1 page_compression_level=8 key_block_size=0;
162+
show warnings;
163+
Level Code Message
164+
show create table innodb_compressed;
165+
Table Create Table
166+
innodb_compressed CREATE TABLE `innodb_compressed` (
167+
`c1` int(11) DEFAULT NULL,
168+
`b` char(20) DEFAULT NULL
169+
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `page_compressed`=1 `page_compression_level`=8
170+
set global innodb_compression_algorithm = 1;
171+
update innodb_page_compressed1 set c1 = c1 + 1;
172+
update innodb_page_compressed2 set c1 = c1 + 1;
173+
update innodb_page_compressed3 set c1 = c1 + 1;
174+
update innodb_page_compressed4 set c1 = c1 + 1;
175+
update innodb_page_compressed5 set c1 = c1 + 1;
176+
update innodb_page_compressed6 set c1 = c1 + 1;
177+
update innodb_page_compressed7 set c1 = c1 + 1;
178+
update innodb_page_compressed8 set c1 = c1 + 1;
179+
update innodb_page_compressed9 set c1 = c1 + 1;
180+
commit;
181+
select count(*) from innodb_compressed;
182+
count(*)
183+
5000
184+
select count(*) from innodb_page_compressed1;
185+
count(*)
186+
5000
187+
select count(*) from innodb_page_compressed1 where c1 < 500000;
188+
count(*)
189+
5000
190+
select count(*) from innodb_page_compressed2 where c1 < 500000;
191+
count(*)
192+
5000
193+
select count(*) from innodb_page_compressed3 where c1 < 500000;
194+
count(*)
195+
5000
196+
select count(*) from innodb_page_compressed4 where c1 < 500000;
197+
count(*)
198+
5000
199+
select count(*) from innodb_page_compressed5 where c1 < 500000;
200+
count(*)
201+
5000
202+
select count(*) from innodb_page_compressed6 where c1 < 500000;
203+
count(*)
204+
5000
205+
select count(*) from innodb_page_compressed7 where c1 < 500000;
206+
count(*)
207+
5000
208+
select count(*) from innodb_page_compressed8 where c1 < 500000;
209+
count(*)
210+
5000
211+
select count(*) from innodb_page_compressed9 where c1 < 500000;
212+
count(*)
213+
5000
214+
set global innodb_compression_algorithm = 0;
215+
update innodb_page_compressed1 set c1 = c1 + 1;
216+
update innodb_page_compressed2 set c1 = c1 + 1;
217+
update innodb_page_compressed3 set c1 = c1 + 1;
218+
update innodb_page_compressed4 set c1 = c1 + 1;
219+
update innodb_page_compressed5 set c1 = c1 + 1;
220+
update innodb_page_compressed6 set c1 = c1 + 1;
221+
update innodb_page_compressed7 set c1 = c1 + 1;
222+
update innodb_page_compressed8 set c1 = c1 + 1;
223+
update innodb_page_compressed9 set c1 = c1 + 1;
224+
commit;
225+
select count(*) from innodb_compressed;
226+
count(*)
227+
5000
228+
select count(*) from innodb_page_compressed1;
229+
count(*)
230+
5000
231+
select count(*) from innodb_page_compressed1 where c1 < 500000;
232+
count(*)
233+
5000
234+
select count(*) from innodb_page_compressed2 where c1 < 500000;
235+
count(*)
236+
5000
237+
select count(*) from innodb_page_compressed3 where c1 < 500000;
238+
count(*)
239+
5000
240+
select count(*) from innodb_page_compressed4 where c1 < 500000;
241+
count(*)
242+
5000
243+
select count(*) from innodb_page_compressed5 where c1 < 500000;
244+
count(*)
245+
5000
246+
select count(*) from innodb_page_compressed6 where c1 < 500000;
247+
count(*)
248+
5000
249+
select count(*) from innodb_page_compressed7 where c1 < 500000;
250+
count(*)
251+
5000
252+
select count(*) from innodb_page_compressed8 where c1 < 500000;
253+
count(*)
254+
5000
255+
select count(*) from innodb_page_compressed9 where c1 < 500000;
256+
count(*)
257+
5000
258+
drop procedure innodb_insert_proc;
259+
drop table innodb_normal;
260+
drop table innodb_compressed;
261+
drop table innodb_page_compressed1;
262+
drop table innodb_page_compressed2;
263+
drop table innodb_page_compressed3;
264+
drop table innodb_page_compressed4;
265+
drop table innodb_page_compressed5;
266+
drop table innodb_page_compressed6;
267+
drop table innodb_page_compressed7;
268+
drop table innodb_page_compressed8;
269+
drop table innodb_page_compressed9;

0 commit comments

Comments
 (0)