Commit 3bca0193 authored by Jan Lindström's avatar Jan Lindström

MDEV-6361: innodb_compression_algorithm configuration variable can

be set to unsupported value.

MDEV-6350: Excessive unnecessary memory allocation at InnoDB/XtraDB
startup if LZO is installed.
parent 0cb7c19f
......@@ -14,8 +14,8 @@
MACRO (MYSQL_CHECK_LZO_STATIC)
#CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
#CHECK_LIBRARY_EXISTS(liblzo2.a lzo1x_1_compress "" HAVE_LZO_LIB)
CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
CHECK_LIBRARY_EXISTS(liblzo2.a lzo1x_1_compress "" HAVE_LZO_LIB)
IF(HAVE_LZO_LIB AND HAVE_LZO_H)
ADD_DEFINITIONS(-DHAVE_LZO=1)
......@@ -25,8 +25,8 @@ ENDMACRO()
MACRO (MYSQL_CHECK_LZO)
#CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
#CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB)
CHECK_INCLUDE_FILES(lzo/lzo1x.h HAVE_LZO_H)
CHECK_LIBRARY_EXISTS(lzo2 lzo1x_1_compress "" HAVE_LZO_SHARED_LIB)
IF(HAVE_LZO_SHARED_LIB AND HAVE_LZO_H)
ADD_DEFINITIONS(-DHAVE_LZO=1)
......
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lz4' AND variable_value = 1`)
{
--skip Test requires InnoDB compiled with liblz4
}
if (`SELECT COUNT(*) = 0 FROM INFORMATION_SCHEMA.GLOBAL_STATUS WHERE LOWER(variable_name) = 'innodb_have_lzo' AND variable_value = 1`)
{
--skip Test requires InnoDB compiled with liblzo
}
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 2;
CREATE TABLE INNODB_COMPRESSED(c1 INT, b char(20)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
CREATE TABLE INNODB_NORMAL (c1 INT, b char(20)) ENGINE=INNODB;
SHOW WARNINGS;
Level Code Message
CREATE TABLE INNODB_PAGE_COMPRESSED1 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=1;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED1;
Table Create Table
INNODB_PAGE_COMPRESSED1 CREATE TABLE `INNODB_PAGE_COMPRESSED1` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=1
CREATE TABLE INNODB_PAGE_COMPRESSED2 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=2;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED2;
Table Create Table
INNODB_PAGE_COMPRESSED2 CREATE TABLE `INNODB_PAGE_COMPRESSED2` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=2
CREATE TABLE INNODB_PAGE_COMPRESSED3 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED3;
Table Create Table
INNODB_PAGE_COMPRESSED3 CREATE TABLE `INNODB_PAGE_COMPRESSED3` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=3
CREATE TABLE INNODB_PAGE_COMPRESSED4 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=4;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED4;
Table Create Table
INNODB_PAGE_COMPRESSED4 CREATE TABLE `INNODB_PAGE_COMPRESSED4` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=4
CREATE TABLE INNODB_PAGE_COMPRESSED5 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=5;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED5;
Table Create Table
INNODB_PAGE_COMPRESSED5 CREATE TABLE `INNODB_PAGE_COMPRESSED5` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=5
CREATE TABLE INNODB_PAGE_COMPRESSED6 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=6;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED6;
Table Create Table
INNODB_PAGE_COMPRESSED6 CREATE TABLE `INNODB_PAGE_COMPRESSED6` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=6
CREATE TABLE INNODB_PAGE_COMPRESSED7 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=7;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED7;
Table Create Table
INNODB_PAGE_COMPRESSED7 CREATE TABLE `INNODB_PAGE_COMPRESSED7` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=7
CREATE TABLE INNODB_PAGE_COMPRESSED8 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED8;
Table Create Table
INNODB_PAGE_COMPRESSED8 CREATE TABLE `INNODB_PAGE_COMPRESSED8` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
CREATE TABLE INNODB_PAGE_COMPRESSED9 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED9;
Table Create Table
INNODB_PAGE_COMPRESSED9 CREATE TABLE `INNODB_PAGE_COMPRESSED9` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9
CREATE PROCEDURE INNODB_INSERT_PROC (REPEAT_COUNT INT)
BEGIN
DECLARE CURRENT_NUM INT;
SET CURRENT_NUM = 0;
WHILE CURRENT_NUM < REPEAT_COUNT DO
INSERT INTO INNODB_NORMAL VALUES(CURRENT_NUM,'Testing..');
SET CURRENT_NUM = CURRENT_NUM + 1;
END WHILE;
END//
COMMIT;
SET AUTOCOMMIT=0;
CALL INNODB_INSERT_PROC(5000);
COMMIT;
SET AUTOCOMMIT=1;
SELECT COUNT(*) FROM INNODB_NORMAL;
COUNT(*)
5000
INSERT INTO INNODB_COMPRESSED SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED1 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED2 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED3 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED4 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED5 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED6 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED7 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED8 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED9 SELECT * FROM INNODB_NORMAL;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
ALTER TABLE INNODB_NORMAL PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_NORMAL;
Table Create Table
INNODB_NORMAL CREATE TABLE `INNODB_NORMAL` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
ALTER TABLE INNODB_COMPRESSED ROW_FORMAT=DEFAULT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_COMPRESSED;
Table Create Table
INNODB_COMPRESSED CREATE TABLE `INNODB_COMPRESSED` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
SET GLOBAL innodb_compression_algorithm = 1;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
SET GLOBAL innodb_compression_algorithm = 0;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
DROP PROCEDURE INNODB_INSERT_PROC;
DROP TABLE INNODB_NORMAL;
DROP TABLE INNODB_COMPRESSED;
DROP TABLE INNODB_PAGE_COMPRESSED1;
DROP TABLE INNODB_PAGE_COMPRESSED2;
DROP TABLE INNODB_PAGE_COMPRESSED3;
DROP TABLE INNODB_PAGE_COMPRESSED4;
DROP TABLE INNODB_PAGE_COMPRESSED5;
DROP TABLE INNODB_PAGE_COMPRESSED6;
DROP TABLE INNODB_PAGE_COMPRESSED7;
DROP TABLE INNODB_PAGE_COMPRESSED8;
DROP TABLE INNODB_PAGE_COMPRESSED9;
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 3;
CREATE TABLE INNODB_COMPRESSED(c1 INT, b char(20)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
CREATE TABLE INNODB_NORMAL (c1 INT, b char(20)) ENGINE=INNODB;
SHOW WARNINGS;
Level Code Message
CREATE TABLE INNODB_PAGE_COMPRESSED1 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=1;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED1;
Table Create Table
INNODB_PAGE_COMPRESSED1 CREATE TABLE `INNODB_PAGE_COMPRESSED1` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=1
CREATE TABLE INNODB_PAGE_COMPRESSED2 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=2;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED2;
Table Create Table
INNODB_PAGE_COMPRESSED2 CREATE TABLE `INNODB_PAGE_COMPRESSED2` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=2
CREATE TABLE INNODB_PAGE_COMPRESSED3 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED3;
Table Create Table
INNODB_PAGE_COMPRESSED3 CREATE TABLE `INNODB_PAGE_COMPRESSED3` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=3
CREATE TABLE INNODB_PAGE_COMPRESSED4 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=4;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED4;
Table Create Table
INNODB_PAGE_COMPRESSED4 CREATE TABLE `INNODB_PAGE_COMPRESSED4` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=4
CREATE TABLE INNODB_PAGE_COMPRESSED5 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=5;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED5;
Table Create Table
INNODB_PAGE_COMPRESSED5 CREATE TABLE `INNODB_PAGE_COMPRESSED5` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=5
CREATE TABLE INNODB_PAGE_COMPRESSED6 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=6;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED6;
Table Create Table
INNODB_PAGE_COMPRESSED6 CREATE TABLE `INNODB_PAGE_COMPRESSED6` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=6
CREATE TABLE INNODB_PAGE_COMPRESSED7 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=7;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED7;
Table Create Table
INNODB_PAGE_COMPRESSED7 CREATE TABLE `INNODB_PAGE_COMPRESSED7` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=7
CREATE TABLE INNODB_PAGE_COMPRESSED8 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED8;
Table Create Table
INNODB_PAGE_COMPRESSED8 CREATE TABLE `INNODB_PAGE_COMPRESSED8` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
CREATE TABLE INNODB_PAGE_COMPRESSED9 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED9;
Table Create Table
INNODB_PAGE_COMPRESSED9 CREATE TABLE `INNODB_PAGE_COMPRESSED9` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9
CREATE PROCEDURE INNODB_INSERT_PROC (REPEAT_COUNT INT)
BEGIN
DECLARE CURRENT_NUM INT;
SET CURRENT_NUM = 0;
WHILE CURRENT_NUM < REPEAT_COUNT DO
INSERT INTO INNODB_NORMAL VALUES(CURRENT_NUM,'Testing..');
SET CURRENT_NUM = CURRENT_NUM + 1;
END WHILE;
END//
COMMIT;
SET AUTOCOMMIT=0;
CALL INNODB_INSERT_PROC(5000);
COMMIT;
SET AUTOCOMMIT=1;
SELECT COUNT(*) FROM INNODB_NORMAL;
COUNT(*)
5000
INSERT INTO INNODB_COMPRESSED SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED1 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED2 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED3 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED4 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED5 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED6 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED7 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED8 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED9 SELECT * FROM INNODB_NORMAL;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
ALTER TABLE INNODB_NORMAL PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_NORMAL;
Table Create Table
INNODB_NORMAL CREATE TABLE `INNODB_NORMAL` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
ALTER TABLE INNODB_COMPRESSED ROW_FORMAT=DEFAULT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_COMPRESSED;
Table Create Table
INNODB_COMPRESSED CREATE TABLE `INNODB_COMPRESSED` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
SET GLOBAL innodb_compression_algorithm = 2;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
SET GLOBAL innodb_compression_algorithm = 1;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
DROP PROCEDURE INNODB_INSERT_PROC;
DROP TABLE INNODB_NORMAL;
DROP TABLE INNODB_COMPRESSED;
DROP TABLE INNODB_PAGE_COMPRESSED1;
DROP TABLE INNODB_PAGE_COMPRESSED2;
DROP TABLE INNODB_PAGE_COMPRESSED3;
DROP TABLE INNODB_PAGE_COMPRESSED4;
DROP TABLE INNODB_PAGE_COMPRESSED5;
DROP TABLE INNODB_PAGE_COMPRESSED6;
DROP TABLE INNODB_PAGE_COMPRESSED7;
DROP TABLE INNODB_PAGE_COMPRESSED8;
DROP TABLE INNODB_PAGE_COMPRESSED9;
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
SET GLOBAL innodb_compression_algorithm = 1;
CREATE TABLE INNODB_COMPRESSED(c1 INT, b char(20)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
Level Code Message
CREATE TABLE INNODB_NORMAL (c1 INT, b char(20)) ENGINE=INNODB;
SHOW WARNINGS;
Level Code Message
CREATE TABLE INNODB_PAGE_COMPRESSED1 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=1;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED1;
Table Create Table
INNODB_PAGE_COMPRESSED1 CREATE TABLE `INNODB_PAGE_COMPRESSED1` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=1
CREATE TABLE INNODB_PAGE_COMPRESSED2 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=2;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED2;
Table Create Table
INNODB_PAGE_COMPRESSED2 CREATE TABLE `INNODB_PAGE_COMPRESSED2` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=2
CREATE TABLE INNODB_PAGE_COMPRESSED3 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED3;
Table Create Table
INNODB_PAGE_COMPRESSED3 CREATE TABLE `INNODB_PAGE_COMPRESSED3` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=3
CREATE TABLE INNODB_PAGE_COMPRESSED4 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=4;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED4;
Table Create Table
INNODB_PAGE_COMPRESSED4 CREATE TABLE `INNODB_PAGE_COMPRESSED4` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=4
CREATE TABLE INNODB_PAGE_COMPRESSED5 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=5;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED5;
Table Create Table
INNODB_PAGE_COMPRESSED5 CREATE TABLE `INNODB_PAGE_COMPRESSED5` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=5
CREATE TABLE INNODB_PAGE_COMPRESSED6 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=6;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED6;
Table Create Table
INNODB_PAGE_COMPRESSED6 CREATE TABLE `INNODB_PAGE_COMPRESSED6` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=6
CREATE TABLE INNODB_PAGE_COMPRESSED7 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=7;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED7;
Table Create Table
INNODB_PAGE_COMPRESSED7 CREATE TABLE `INNODB_PAGE_COMPRESSED7` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=7
CREATE TABLE INNODB_PAGE_COMPRESSED8 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED8;
Table Create Table
INNODB_PAGE_COMPRESSED8 CREATE TABLE `INNODB_PAGE_COMPRESSED8` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
CREATE TABLE INNODB_PAGE_COMPRESSED9 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED9;
Table Create Table
INNODB_PAGE_COMPRESSED9 CREATE TABLE `INNODB_PAGE_COMPRESSED9` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=9
CREATE PROCEDURE INNODB_INSERT_PROC (REPEAT_COUNT INT)
BEGIN
DECLARE CURRENT_NUM INT;
SET CURRENT_NUM = 0;
WHILE CURRENT_NUM < REPEAT_COUNT DO
INSERT INTO INNODB_NORMAL VALUES(CURRENT_NUM,'Testing..');
SET CURRENT_NUM = CURRENT_NUM + 1;
END WHILE;
END//
COMMIT;
SET AUTOCOMMIT=0;
CALL INNODB_INSERT_PROC(5000);
COMMIT;
SET AUTOCOMMIT=1;
SELECT COUNT(*) FROM INNODB_NORMAL;
COUNT(*)
5000
INSERT INTO INNODB_COMPRESSED SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED1 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED2 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED3 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED4 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED5 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED6 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED7 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED8 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED9 SELECT * FROM INNODB_NORMAL;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
ALTER TABLE INNODB_NORMAL PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_NORMAL;
Table Create Table
INNODB_NORMAL CREATE TABLE `INNODB_NORMAL` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
ALTER TABLE INNODB_COMPRESSED ROW_FORMAT=DEFAULT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
Level Code Message
SHOW CREATE TABLE INNODB_COMPRESSED;
Table Create Table
INNODB_COMPRESSED CREATE TABLE `INNODB_COMPRESSED` (
`c1` int(11) DEFAULT NULL,
`b` char(20) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1 `PAGE_COMPRESSED`=1 `PAGE_COMPRESSION_LEVEL`=8
SET GLOBAL innodb_compression_algorithm = 0;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
COUNT(*)
5000
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
COUNT(*)
5000
DROP PROCEDURE INNODB_INSERT_PROC;
DROP TABLE INNODB_NORMAL;
DROP TABLE INNODB_COMPRESSED;
DROP TABLE INNODB_PAGE_COMPRESSED1;
DROP TABLE INNODB_PAGE_COMPRESSED2;
DROP TABLE INNODB_PAGE_COMPRESSED3;
DROP TABLE INNODB_PAGE_COMPRESSED4;
DROP TABLE INNODB_PAGE_COMPRESSED5;
DROP TABLE INNODB_PAGE_COMPRESSED6;
DROP TABLE INNODB_PAGE_COMPRESSED7;
DROP TABLE INNODB_PAGE_COMPRESSED8;
DROP TABLE INNODB_PAGE_COMPRESSED9;
-- source include/have_innodb.inc
-- source include/have_innodb_lz4.inc
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# LZ4
SET GLOBAL innodb_compression_algorithm = 2;
CREATE TABLE INNODB_COMPRESSED(c1 INT, b char(20)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
CREATE TABLE INNODB_NORMAL (c1 INT, b char(20)) ENGINE=INNODB;
SHOW WARNINGS;
CREATE TABLE INNODB_PAGE_COMPRESSED1 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=1;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED1;
CREATE TABLE INNODB_PAGE_COMPRESSED2 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=2;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED2;
CREATE TABLE INNODB_PAGE_COMPRESSED3 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED3;
CREATE TABLE INNODB_PAGE_COMPRESSED4 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=4;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED4;
CREATE TABLE INNODB_PAGE_COMPRESSED5 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=5;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED5;
CREATE TABLE INNODB_PAGE_COMPRESSED6 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=6;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED6;
CREATE TABLE INNODB_PAGE_COMPRESSED7 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=7;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED7;
CREATE TABLE INNODB_PAGE_COMPRESSED8 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED8;
CREATE TABLE INNODB_PAGE_COMPRESSED9 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED9;
DELIMITER //;
CREATE PROCEDURE INNODB_INSERT_PROC (REPEAT_COUNT INT)
BEGIN
DECLARE CURRENT_NUM INT;
SET CURRENT_NUM = 0;
WHILE CURRENT_NUM < REPEAT_COUNT DO
INSERT INTO INNODB_NORMAL VALUES(CURRENT_NUM,'Testing..');
SET CURRENT_NUM = CURRENT_NUM + 1;
END WHILE;
END//
DELIMITER ;//
COMMIT;
SET AUTOCOMMIT=0;
CALL INNODB_INSERT_PROC(5000);
COMMIT;
SET AUTOCOMMIT=1;
SELECT COUNT(*) FROM INNODB_NORMAL;
INSERT INTO INNODB_COMPRESSED SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED1 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED2 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED3 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED4 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED5 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED6 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED7 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED8 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED9 SELECT * FROM INNODB_NORMAL;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
ALTER TABLE INNODB_NORMAL PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_NORMAL;
ALTER TABLE INNODB_COMPRESSED ROW_FORMAT=DEFAULT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_COMPRESSED;
# ZLIB
SET GLOBAL innodb_compression_algorithm = 1;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
# NONE
SET GLOBAL innodb_compression_algorithm = 0;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
DROP PROCEDURE INNODB_INSERT_PROC;
DROP TABLE INNODB_NORMAL;
DROP TABLE INNODB_COMPRESSED;
DROP TABLE INNODB_PAGE_COMPRESSED1;
DROP TABLE INNODB_PAGE_COMPRESSED2;
DROP TABLE INNODB_PAGE_COMPRESSED3;
DROP TABLE INNODB_PAGE_COMPRESSED4;
DROP TABLE INNODB_PAGE_COMPRESSED5;
DROP TABLE INNODB_PAGE_COMPRESSED6;
DROP TABLE INNODB_PAGE_COMPRESSED7;
DROP TABLE INNODB_PAGE_COMPRESSED8;
DROP TABLE INNODB_PAGE_COMPRESSED9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
-- source include/have_innodb.inc
-- source include/have_innodb_lzo.inc
-- source include/have_innodb_lz4.inc
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# LZO
SET GLOBAL innodb_compression_algorithm = 3;
CREATE TABLE INNODB_COMPRESSED(c1 INT, b char(20)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
CREATE TABLE INNODB_NORMAL (c1 INT, b char(20)) ENGINE=INNODB;
SHOW WARNINGS;
CREATE TABLE INNODB_PAGE_COMPRESSED1 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=1;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED1;
CREATE TABLE INNODB_PAGE_COMPRESSED2 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=2;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED2;
CREATE TABLE INNODB_PAGE_COMPRESSED3 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED3;
CREATE TABLE INNODB_PAGE_COMPRESSED4 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=4;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED4;
CREATE TABLE INNODB_PAGE_COMPRESSED5 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=5;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED5;
CREATE TABLE INNODB_PAGE_COMPRESSED6 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=6;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED6;
CREATE TABLE INNODB_PAGE_COMPRESSED7 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=7;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED7;
CREATE TABLE INNODB_PAGE_COMPRESSED8 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED8;
CREATE TABLE INNODB_PAGE_COMPRESSED9 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED9;
DELIMITER //;
CREATE PROCEDURE INNODB_INSERT_PROC (REPEAT_COUNT INT)
BEGIN
DECLARE CURRENT_NUM INT;
SET CURRENT_NUM = 0;
WHILE CURRENT_NUM < REPEAT_COUNT DO
INSERT INTO INNODB_NORMAL VALUES(CURRENT_NUM,'Testing..');
SET CURRENT_NUM = CURRENT_NUM + 1;
END WHILE;
END//
DELIMITER ;//
COMMIT;
SET AUTOCOMMIT=0;
CALL INNODB_INSERT_PROC(5000);
COMMIT;
SET AUTOCOMMIT=1;
SELECT COUNT(*) FROM INNODB_NORMAL;
INSERT INTO INNODB_COMPRESSED SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED1 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED2 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED3 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED4 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED5 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED6 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED7 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED8 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED9 SELECT * FROM INNODB_NORMAL;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
ALTER TABLE INNODB_NORMAL PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_NORMAL;
ALTER TABLE INNODB_COMPRESSED ROW_FORMAT=DEFAULT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_COMPRESSED;
# LZ4
SET GLOBAL innodb_compression_algorithm = 2;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
# zlib
SET GLOBAL innodb_compression_algorithm = 1;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
DROP PROCEDURE INNODB_INSERT_PROC;
DROP TABLE INNODB_NORMAL;
DROP TABLE INNODB_COMPRESSED;
DROP TABLE INNODB_PAGE_COMPRESSED1;
DROP TABLE INNODB_PAGE_COMPRESSED2;
DROP TABLE INNODB_PAGE_COMPRESSED3;
DROP TABLE INNODB_PAGE_COMPRESSED4;
DROP TABLE INNODB_PAGE_COMPRESSED5;
DROP TABLE INNODB_PAGE_COMPRESSED6;
DROP TABLE INNODB_PAGE_COMPRESSED7;
DROP TABLE INNODB_PAGE_COMPRESSED8;
DROP TABLE INNODB_PAGE_COMPRESSED9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
-- source include/have_innodb.inc
--disable_query_log
let $innodb_compression_algorithm_orig=`SELECT @@innodb_compression_algorithm`;
let $innodb_file_format_orig = `SELECT @@innodb_file_format`;
let $innodb_file_per_table_orig = `SELECT @@innodb_file_per_table`;
--enable_query_log
SET GLOBAL innodb_file_format = `Barracuda`;
SET GLOBAL innodb_file_per_table = ON;
# ZLIB
SET GLOBAL innodb_compression_algorithm = 1;
CREATE TABLE INNODB_COMPRESSED(c1 INT, b char(20)) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=8;
SHOW WARNINGS;
CREATE TABLE INNODB_NORMAL (c1 INT, b char(20)) ENGINE=INNODB;
SHOW WARNINGS;
CREATE TABLE INNODB_PAGE_COMPRESSED1 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=1;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED1;
CREATE TABLE INNODB_PAGE_COMPRESSED2 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=2;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED2;
CREATE TABLE INNODB_PAGE_COMPRESSED3 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=3;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED3;
CREATE TABLE INNODB_PAGE_COMPRESSED4 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=4;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED4;
CREATE TABLE INNODB_PAGE_COMPRESSED5 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=5;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED5;
CREATE TABLE INNODB_PAGE_COMPRESSED6 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=6;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED6;
CREATE TABLE INNODB_PAGE_COMPRESSED7 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=7;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED7;
CREATE TABLE INNODB_PAGE_COMPRESSED8 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED8;
CREATE TABLE INNODB_PAGE_COMPRESSED9 (c1 INT, b char(20)) ENGINE=INNODB PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=9;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_PAGE_COMPRESSED9;
DELIMITER //;
CREATE PROCEDURE INNODB_INSERT_PROC (REPEAT_COUNT INT)
BEGIN
DECLARE CURRENT_NUM INT;
SET CURRENT_NUM = 0;
WHILE CURRENT_NUM < REPEAT_COUNT DO
INSERT INTO INNODB_NORMAL VALUES(CURRENT_NUM,'Testing..');
SET CURRENT_NUM = CURRENT_NUM + 1;
END WHILE;
END//
DELIMITER ;//
COMMIT;
SET AUTOCOMMIT=0;
CALL INNODB_INSERT_PROC(5000);
COMMIT;
SET AUTOCOMMIT=1;
SELECT COUNT(*) FROM INNODB_NORMAL;
INSERT INTO INNODB_COMPRESSED SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED1 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED2 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED3 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED4 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED5 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED6 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED7 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED8 SELECT * FROM INNODB_NORMAL;
INSERT INTO INNODB_PAGE_COMPRESSED9 SELECT * FROM INNODB_NORMAL;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
ALTER TABLE INNODB_NORMAL PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_NORMAL;
ALTER TABLE INNODB_COMPRESSED ROW_FORMAT=DEFAULT PAGE_COMPRESSED=1 PAGE_COMPRESSION_LEVEL=8 KEY_BLOCK_SIZE=0;
SHOW WARNINGS;
SHOW CREATE TABLE INNODB_COMPRESSED;
# NONE
SET GLOBAL innodb_compression_algorithm = 0;
UPDATE INNODB_PAGE_COMPRESSED1 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED2 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED3 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED4 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED5 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED6 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED7 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED8 SET c1 = c1 + 1;
UPDATE INNODB_PAGE_COMPRESSED9 SET c1 = c1 + 1;
COMMIT;
SELECT COUNT(*) FROM INNODB_COMPRESSED;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED1 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED2 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED3 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED4 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED5 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED6 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED7 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED8 WHERE C1 < 500000;
SELECT COUNT(*) FROM INNODB_PAGE_COMPRESSED9 WHERE C1 < 500000;
DROP PROCEDURE INNODB_INSERT_PROC;
DROP TABLE INNODB_NORMAL;
DROP TABLE INNODB_COMPRESSED;
DROP TABLE INNODB_PAGE_COMPRESSED1;
DROP TABLE INNODB_PAGE_COMPRESSED2;
DROP TABLE INNODB_PAGE_COMPRESSED3;
DROP TABLE INNODB_PAGE_COMPRESSED4;
DROP TABLE INNODB_PAGE_COMPRESSED5;
DROP TABLE INNODB_PAGE_COMPRESSED6;
DROP TABLE INNODB_PAGE_COMPRESSED7;
DROP TABLE INNODB_PAGE_COMPRESSED8;
DROP TABLE INNODB_PAGE_COMPRESSED9;
# reset system
--disable_query_log
EVAL SET GLOBAL innodb_compression_algorithm = $innodb_compression_algorithm_orig;
EVAL SET GLOBAL innodb_file_per_table = $innodb_file_per_table_orig;
EVAL SET GLOBAL innodb_file_format = $innodb_file_format_orig;
--enable_query_log
select @@global.innodb_have_lz4;
@@global.innodb_have_lz4
0
select @@global.innodb_have_lzo;
@@global.innodb_have_lzo
0
--innodb-compression-algorithm=1
\ No newline at end of file
--source include/have_innodb.inc
--let $inno= `select @@global.innodb_have_lz4`
--replace_result $inno 0
select @@global.innodb_have_lz4;
--source include/have_innodb.inc
--let $inno= `select @@global.innodb_have_lzo`
--replace_result $inno 0
select @@global.innodb_have_lzo;
......@@ -173,6 +173,11 @@ fil_compress_page(
}
break;
case PAGE_UNCOMPRESSED:
*out_len = len;
return (buf);
break;
default:
ut_error;
break;
......
......@@ -559,7 +559,23 @@ static inline
ulint
innobase_map_isolation_level(
/*=========================*/
enum_tx_isolation iso); /*!< in: MySQL isolation level code */
enum_tx_isolation iso); /*!< in: MySQL isolation level code
*/
/*************************************************************//**
Check for a valid value of innobase_compression_algorithm.
@return 0 for valid innodb_compression_algorithm. */
static
int
innodb_compression_algorithm_validate(
/*==================================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to system
variable */
void* save, /*!< out: immediate result
for update function */
struct st_mysql_value* value); /*!< in: incoming string */
static const char innobase_hton_name[]= "InnoDB";
......@@ -723,6 +739,10 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_page_compressed_trim_op_saved, SHOW_LONGLONG},
{"num_pages_page_decompressed",
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
{"have_lz4",
(char*) &export_vars.innodb_have_lz4, SHOW_LONG},
{"have_lzo",
(char*) &export_vars.innodb_have_lzo, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
......@@ -2986,6 +3006,24 @@ innobase_init(
}
}
#ifndef HAVE_LZ4
if (innodb_compression_algorithm == PAGE_LZ4_ALGORITHM) {
sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblz4 is not installed. \n",
innodb_compression_algorithm);
goto error;
}
#endif
#ifndef HAVE_LZO
if (innodb_compression_algorithm == PAGE_LZO_ALGORITHM) {
sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblzo is not installed. \n",
innodb_compression_algorithm);
goto error;
}
#endif
os_innodb_umask = (ulint) my_umask;
/* First calculate the default path for innodb_data_home_dir etc.,
......@@ -17022,9 +17060,21 @@ static TYPELIB page_compression_algorithms_typelib=
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG,
"Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo",
NULL, NULL, default_compression_algorithm,
innodb_compression_algorithm_validate, NULL, default_compression_algorithm,
&page_compression_algorithms_typelib);
static MYSQL_SYSVAR_ULONG(have_lz4, srv_have_lz4,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblz4",
NULL, NULL, srv_have_lz4,
0, 1, 0);
static MYSQL_SYSVAR_ULONG(have_lzo, srv_have_lzo,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblzo",
NULL, NULL, srv_have_lzo,
0, 1, 0);
static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of multi-threaded flush threads",
......@@ -17201,6 +17251,8 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(compression_algorithm),
MYSQL_SYSVAR(mtflush_threads),
MYSQL_SYSVAR(use_mtflush),
MYSQL_SYSVAR(have_lz4),
MYSQL_SYSVAR(have_lzo),
NULL
};
......@@ -17703,3 +17755,72 @@ innobase_convert_to_system_charset(
static_cast<uint>(len), errors));
}
/*************************************************************//**
Check for a valid value of innobase_compression_algorithm.
@return 0 for valid innodb_compression_algorithm. */
static
int
innodb_compression_algorithm_validate(
/*==================================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to system
variable */
void* save, /*!< out: immediate result
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
long compression_algorithm;
DBUG_ENTER("innobase_compression_algorithm_validate");
if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) {
char buff[STRING_BUFFER_USUAL_SIZE];
const char *str;
int length= sizeof(buff);
if (!(str= value->val_str(value, buff, &length))) {
DBUG_RETURN(1);
}
if ((compression_algorithm= (long)find_type(str, &page_compression_algorithms_typelib, 0) - 1) < 0) {
DBUG_RETURN(1);
}
} else {
long long tmp;
if (value->val_int(value, &tmp)) {
DBUG_RETURN(1);
}
if (tmp < 0 || tmp >= page_compression_algorithms_typelib.count) {
DBUG_RETURN(1);
}
compression_algorithm= (long) tmp;
}
*reinterpret_cast<ulong*>(save) = compression_algorithm;
#ifndef HAVE_LZ4
if (compression_algorithm == PAGE_LZ4_ALGORITHM) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblz4 is not installed. \n",
compression_algorithm);
DBUG_RETURN(1);
}
#endif
#ifndef HAVE_LZO
if (compression_algorithm == PAGE_LZO_ALGORITHM) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblzo is not installed. \n",
compression_algorithm);
DBUG_RETURN(1);
}
#endif
DBUG_RETURN(0);
}
......@@ -264,6 +264,9 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */
extern my_bool srv_use_mtflush;
extern ulong srv_have_lz4;
extern ulong srv_have_lzo;
#ifdef __WIN__
extern ibool srv_use_native_conditions;
#endif /* __WIN__ */
......@@ -916,6 +919,8 @@ struct export_var_t{
compression */
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
compression errors */
ulint innodb_have_lz4; /*!< HAVE_LZ4 */
ulint innodb_have_lzo; /*!< HAVE_LZO */
};
/** Thread slot in the thread table. */
......
......@@ -224,12 +224,7 @@ struct os_aio_slot_t{
int n_bytes; /* bytes written/read. */
int ret; /* AIO return code */
#endif /* WIN_ASYNC_IO */
#ifdef HAVE_LZO
byte lzo_mem[LZO1X_1_15_MEM_COMPRESS];
#else
byte lzo_mem[1]; /* Temporal memory used by LZO */
#endif
byte *lzo_mem; /* Temporal memory used by LZO */
};
/** The asynchronous i/o array structure */
......@@ -366,6 +361,17 @@ os_slot_alloc_page_buf(
/*===================*/
os_aio_slot_t* slot); /*!< in: slot structure */
#ifdef HAVE_LZO
/**********************************************************************//**
Allocate memory for temporal memory used for page compression when
LZO compression method is used */
UNIV_INTERN
void
os_slot_alloc_lzo_mem(
/*===================*/
os_aio_slot_t* slot); /*!< in: slot structure */
#endif
/****************************************************************//**
Does error handling when a file operation fails.
@return TRUE if we should retry the operation */
......@@ -4094,6 +4100,11 @@ os_aio_array_free(
ut_free(slot->page_compression_page);
slot->page_compression_page = NULL;
}
if (slot->lzo_mem) {
ut_free(slot->lzo_mem);
slot->lzo_mem = NULL;
}
}
ut_free(array->slots);
......@@ -4548,7 +4559,11 @@ os_aio_array_reserve_slot(
os_slot_alloc_page_buf(slot);
}
ut_ad(slot->page_buf);
#ifdef HAVE_LZO
if (innodb_compression_algorithm == 3 && slot->lzo_mem == NULL) {
os_slot_alloc_lzo_mem(slot);
}
#endif
/* Call page compression */
tmp = fil_compress_page(fil_node_get_space_id(slot->message1),
......@@ -5232,7 +5247,11 @@ os_aio_windows_handle(
if (slot->page_buf == NULL) {
os_slot_alloc_page_buf(slot);
}
ut_ad(slot->page_buf);
#ifdef HAVE_LZO
if (innodb_compression_algorithm == 3 && slot->lzo_mem == NULL) {
os_slot_alloc_lzo_mem(slot);
}
#endif
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
......@@ -5346,7 +5365,12 @@ os_aio_linux_collect(
if (slot->page_buf == NULL) {
os_slot_alloc_page_buf(slot);
}
ut_ad(slot->page_buf);
#ifdef HAVE_LZO
if (innodb_compression_algorithm == 3 && slot->lzo_mem == NULL) {
os_slot_alloc_lzo_mem(slot);
}
#endif
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
......@@ -6351,9 +6375,27 @@ os_slot_alloc_page_buf(
byte* cbuf2;
byte* cbuf;
ut_a(slot != NULL);
/* We allocate extra to avoid memory overwrite on compression */
cbuf2 = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE*2));
cbuf = static_cast<byte *>(ut_align(cbuf2, UNIV_PAGE_SIZE));
slot->page_compression_page = static_cast<byte *>(cbuf2);
slot->page_buf = static_cast<byte *>(cbuf);
ut_a(slot->page_buf != NULL);
}
#ifdef HAVE_LZO
/**********************************************************************//**
Allocate memory for temporal memory used for page compression when
LZO compression method is used */
UNIV_INTERN
void
os_slot_alloc_lzo_mem(
/*===================*/
os_aio_slot_t* slot) /*!< in: slot structure */
{
ut_a(slot != NULL);
slot->lzo_mem = static_cast<byte *>(ut_malloc(LZO1X_1_15_MEM_COMPRESS));
ut_a(slot->lzo_mem != NULL);
}
#endif
......@@ -209,6 +209,18 @@ UNIV_INTERN uint srv_flush_log_at_timeout = 1;
UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF;
UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF;
#ifdef HAVE_LZ4
UNIV_INTERN ulong srv_have_lz4 = 1;
#else
UNIV_INTERN ulong srv_have_lz4 = 0;
#endif
#ifdef HAVE_LZO
UNIV_INTERN ulong srv_have_lzo = 1;
#else
UNIV_INTERN ulong srv_have_lzo = 0;
#endif
/* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */
UNIV_INTERN char srv_adaptive_flushing = TRUE;
......@@ -1422,6 +1434,9 @@ srv_export_innodb_status(void)
#endif
export_vars.innodb_page_size = UNIV_PAGE_SIZE;
export_vars.innodb_have_lz4 = srv_have_lz4;
export_vars.innodb_have_lzo = srv_have_lzo;
export_vars.innodb_log_waits = srv_stats.log_waits;
export_vars.innodb_os_log_written = srv_stats.os_log_written;
......
......@@ -21,8 +21,8 @@ INCLUDE(CheckCSourceRuns)
INCLUDE(lz4)
INCLUDE(lzo)
MYSQL_CHECK_LZ4_STATIC()
MYSQL_CHECK_LZO_STATIC()
MYSQL_CHECK_LZ4()
MYSQL_CHECK_LZO()
# OS tests
IF(UNIX)
......
......@@ -173,6 +173,10 @@ fil_compress_page(
}
break;
case PAGE_UNCOMPRESSED:
*out_len = len;
return (buf);
break;
default:
ut_error;
break;
......
......@@ -654,6 +654,20 @@ static int innobase_checkpoint_state(handlerton *hton, bool disable)
return 0;
}
/*************************************************************//**
Check for a valid value of innobase_compression_algorithm.
@return 0 for valid innodb_compression_algorithm. */
static
int
innodb_compression_algorithm_validate(
/*==================================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to system
variable */
void* save, /*!< out: immediate result
for update function */
struct st_mysql_value* value); /*!< in: incoming string */
static const char innobase_hton_name[]= "InnoDB";
static MYSQL_THDVAR_BOOL(support_xa, PLUGIN_VAR_OPCMDARG,
......@@ -919,6 +933,10 @@ static SHOW_VAR innodb_status_variables[]= {
(char*) &export_vars.innodb_page_compressed_trim_op_saved, SHOW_LONGLONG},
{"num_pages_page_decompressed",
(char*) &export_vars.innodb_pages_page_decompressed, SHOW_LONGLONG},
{"have_lz4",
(char*) &export_vars.innodb_have_lz4, SHOW_LONG},
{"have_lzo",
(char*) &export_vars.innodb_have_lzo, SHOW_LONG},
{NullS, NullS, SHOW_LONG}
};
......@@ -3373,6 +3391,24 @@ innobase_init(
}
}
#ifndef HAVE_LZ4
if (innodb_compression_algorithm == PAGE_LZ4_ALGORITHM) {
sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblz4 is not installed. \n",
innodb_compression_algorithm);
goto error;
}
#endif
#ifndef HAVE_LZO
if (innodb_compression_algorithm == PAGE_LZO_ALGORITHM) {
sql_print_error("InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblzo is not installed. \n",
innodb_compression_algorithm);
goto error;
}
#endif
os_innodb_umask = (ulint) my_umask;
/* First calculate the default path for innodb_data_home_dir etc.,
......@@ -18200,9 +18236,21 @@ static TYPELIB page_compression_algorithms_typelib=
static MYSQL_SYSVAR_ENUM(compression_algorithm, innodb_compression_algorithm,
PLUGIN_VAR_OPCMDARG,
"Compression algorithm used on page compression. One of: none, zlib, lz4, or lzo",
NULL, NULL, default_compression_algorithm,
innodb_compression_algorithm_validate, NULL, default_compression_algorithm,
&page_compression_algorithms_typelib);
static MYSQL_SYSVAR_ULONG(have_lz4, srv_have_lz4,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblz4",
NULL, NULL, srv_have_lz4,
0, 1, 0);
static MYSQL_SYSVAR_ULONG(have_lzo, srv_have_lzo,
PLUGIN_VAR_READONLY,
"InnoDB compiled support with liblzo",
NULL, NULL, srv_have_lzo,
0, 1, 0);
static MYSQL_SYSVAR_LONG(mtflush_threads, srv_mtflush_threads,
PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,
"Number of multi-threaded flush threads",
......@@ -18417,6 +18465,9 @@ static struct st_mysql_sys_var* innobase_system_variables[]= {
MYSQL_SYSVAR(compression_algorithm),
MYSQL_SYSVAR(mtflush_threads),
MYSQL_SYSVAR(use_mtflush),
MYSQL_SYSVAR(have_lz4),
MYSQL_SYSVAR(have_lzo),
NULL
};
......@@ -18917,12 +18968,83 @@ int ha_innobase::multi_range_read_explain_info(uint mrr_mode, char *str, size_t
return ds_mrr.dsmrr_explain_info(mrr_mode, str, size);
}
/*
/*
A helper function used only in index_cond_func_innodb
*/
bool ha_innobase::is_thd_killed()
{
{
return thd_kill_level(user_thd);
}
/*************************************************************//**
Check for a valid value of innobase_compression_algorithm.
@return 0 for valid innodb_compression_algorithm. */
static
int
innodb_compression_algorithm_validate(
/*==================================*/
THD* thd, /*!< in: thread handle */
struct st_mysql_sys_var* var, /*!< in: pointer to system
variable */
void* save, /*!< out: immediate result
for update function */
struct st_mysql_value* value) /*!< in: incoming string */
{
long compression_algorithm;
DBUG_ENTER("innobase_compression_algorithm_validate");
if (value->value_type(value) == MYSQL_VALUE_TYPE_STRING) {
char buff[STRING_BUFFER_USUAL_SIZE];
const char *str;
int length= sizeof(buff);
if (!(str= value->val_str(value, buff, &length))) {
DBUG_RETURN(1);
}
if ((compression_algorithm= (long)find_type(str, &page_compression_algorithms_typelib, 0) - 1) < 0) {
DBUG_RETURN(1);
}
} else {
long long tmp;
if (value->val_int(value, &tmp)) {
DBUG_RETURN(1);
}
if (tmp < 0 || tmp >= page_compression_algorithms_typelib.count) {
DBUG_RETURN(1);
}
compression_algorithm= (long) tmp;
}
*reinterpret_cast<ulong*>(save) = compression_algorithm;
#ifndef HAVE_LZ4
if (compression_algorithm == PAGE_LZ4_ALGORITHM) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblz4 is not installed. \n",
compression_algorithm);
DBUG_RETURN(1);
}
#endif
#ifndef HAVE_LZO
if (compression_algorithm == PAGE_LZO_ALGORITHM) {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
HA_ERR_UNSUPPORTED,
"InnoDB: innodb_compression_algorithm = %lu unsupported.\n"
"InnoDB: liblzo is not installed. \n",
compression_algorithm);
DBUG_RETURN(1);
}
#endif
DBUG_RETURN(0);
}
......@@ -282,6 +282,9 @@ extern long srv_mtflush_threads;
/* If this flag is TRUE, then we will use multi threaded flush. */
extern my_bool srv_use_mtflush;
extern ulong srv_have_lz4;
extern ulong srv_have_lzo;
/** Server undo tablespaces directory, can be absolute path. */
extern char* srv_undo_dir;
......@@ -1127,6 +1130,8 @@ struct export_var_t{
compression */
ib_int64_t innodb_pages_page_compression_error;/*!< Number of page
compression errors */
ulint innodb_have_lz4; /*!< HAVE_LZ4 */
ulint innodb_have_lzo; /*!< HAVE_LZO */
};
/** Thread slot in the thread table. */
......
......@@ -233,12 +233,7 @@ struct os_aio_slot_t{
int n_bytes; /* bytes written/read. */
int ret; /* AIO return code */
#endif /* WIN_ASYNC_IO */
#ifdef HAVE_LZO
byte lzo_mem[LZO1X_1_15_MEM_COMPRESS];
#else
byte lzo_mem[1]; /* Temporal memory used by LZO */
#endif
byte *lzo_mem; /* Temporal memory used by LZO */
};
/** The asynchronous i/o array structure */
......@@ -366,6 +361,17 @@ os_slot_alloc_page_buf(
/*===================*/
os_aio_slot_t* slot); /*!< in: slot structure */
#ifdef HAVE_LZO
/**********************************************************************//**
Allocate memory for temporal memory used for page compression when
LZO compression method is used */
UNIV_INTERN
void
os_slot_alloc_lzo_mem(
/*===================*/
os_aio_slot_t* slot); /*!< in: slot structure */
#endif
/****************************************************************//**
Does error handling when a file operation fails.
@return TRUE if we should retry the operation */
......@@ -4202,6 +4208,11 @@ os_aio_array_free(
ut_free(slot->page_compression_page);
slot->page_compression_page = NULL;
}
if (slot->lzo_mem) {
ut_free(slot->lzo_mem);
slot->lzo_mem = NULL;
}
}
ut_free(array->slots);
......@@ -4669,7 +4680,11 @@ os_aio_array_reserve_slot(
os_slot_alloc_page_buf(slot);
}
ut_ad(slot->page_buf);
#ifdef HAVE_LZO
if (innodb_compression_algorithm == 3 && slot->lzo_mem == NULL) {
os_slot_alloc_lzo_mem(slot);
}
#endif
/* Call page compression */
tmp = fil_compress_page(fil_node_get_space_id(slot->message1),
......@@ -5299,8 +5314,12 @@ os_aio_windows_handle(
if (slot->page_buf == NULL) {
os_slot_alloc_page_buf(slot);
}
ut_ad(slot->page_buf);
#ifdef HAVE_LZO
if (innodb_compression_algorithm == 3 && slot->lzo_mem == NULL) {
os_slot_alloc_lzo_mem(slot);
}
#endif
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
fil_decompress_page(slot->page_buf, slot->buf, slot->len, slot->write_size);
......@@ -5413,8 +5432,12 @@ os_aio_linux_collect(
if (slot->page_buf == NULL) {
os_slot_alloc_page_buf(slot);
}
ut_ad(slot->page_buf);
#ifdef HAVE_LZO
if (innodb_compression_algorithm == 3 && slot->lzo_mem == NULL) {
os_slot_alloc_lzo_mem(slot);
}
#endif
if (slot->type == OS_FILE_READ) {
if (fil_page_is_compressed(slot->buf)) {
fil_decompress_page(slot->page_buf, slot->buf, slot->len, slot->write_size);
......@@ -6459,9 +6482,27 @@ os_slot_alloc_page_buf(
byte* cbuf2;
byte* cbuf;
ut_a(slot != NULL);
/* We allocate extra to avoid memory overwrite on compression */
cbuf2 = static_cast<byte *>(ut_malloc(UNIV_PAGE_SIZE*2));
cbuf = static_cast<byte *>(ut_align(cbuf2, UNIV_PAGE_SIZE));
slot->page_compression_page = static_cast<byte *>(cbuf2);
slot->page_buf = static_cast<byte *>(cbuf);
ut_a(slot->page_buf != NULL);
}
#ifdef HAVE_LZO
/**********************************************************************//**
Allocate memory for temporal memory used for page compression when
LZO compression method is used */
UNIV_INTERN
void
os_slot_alloc_lzo_mem(
/*===================*/
os_aio_slot_t* slot) /*!< in: slot structure */
{
ut_a(slot != NULL);
slot->lzo_mem = static_cast<byte *>(ut_malloc(LZO1X_1_15_MEM_COMPRESS));
ut_a(slot->lzo_mem != NULL);
}
#endif
......@@ -237,6 +237,18 @@ UNIV_INTERN ulong srv_page_size = UNIV_PAGE_SIZE_DEF;
UNIV_INTERN ulong srv_page_size_shift = UNIV_PAGE_SIZE_SHIFT_DEF;
UNIV_INTERN char srv_use_global_flush_log_at_trx_commit = TRUE;
#ifdef HAVE_LZ4
UNIV_INTERN ulong srv_have_lz4 = 1;
#else
UNIV_INTERN ulong srv_have_lz4 = 0;
#endif
#ifdef HAVE_LZO
UNIV_INTERN ulong srv_have_lzo = 1;
#else
UNIV_INTERN ulong srv_have_lzo = 0;
#endif
/* Try to flush dirty pages so as to avoid IO bursts at
the checkpoints. */
UNIV_INTERN char srv_adaptive_flushing = TRUE;
......@@ -1801,6 +1813,9 @@ srv_export_innodb_status(void)
#endif
export_vars.innodb_page_size = UNIV_PAGE_SIZE;
export_vars.innodb_have_lz4 = srv_have_lz4;
export_vars.innodb_have_lzo = srv_have_lzo;
export_vars.innodb_log_waits = srv_stats.log_waits;
export_vars.innodb_os_log_written = srv_stats.os_log_written;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment