Description:
* When doing backup using innobackup, use compression option (--compress)
* Use different levels for compression options like 0 and 1
* The execution of innobackup --compress=0{or 1} gives the same level of compression for both 0 and 1
* The manuals specify that
"Compression level is an integer between 0 and 9: 1 gives fastest compression, 9 gives best compression, and 0 means no compression"
* But in reality, even --compress=0 gives the same level of compression as that of --compress=1
* Ideally there should not be any compression for --compress=0 as stated in InnoDB Hot Backup manuals.
How to repeat:
We will repeat the same test for different levels of compression
1. without compression option
2. with --compress=1
3. with --compress=0
CREATE DATABASE db1;
CREATE DATABASE db2;
CREATE TABLE db1.t1(id INT)ENGINE=INNODB;
CREATE TABLE db2.t2(a CHAR(10))ENGINE=INNODB;
INSERT INTO db1.t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8),
(9),(10),(11),(12),(13),(14),(15);
INSERT INTO db2.t2 VALUES
('a'),('b'),('c'),('d'),('e'),('f'),
('g'),('h'),('i'),('j'),('k'),('l');
INSERT INTO db1.t1 SELECT * FROM db1.t1;
INSERT INTO db1.t1 SELECT * FROM db1.t1;
INSERT INTO db1.t1 SELECT * FROM db1.t1;
INSERT INTO db1.t1 SELECT * FROM db1.t1;
INSERT INTO db1.t1 SELECT * FROM db1.t1;
INSERT INTO db2.t2 SELECT * FROM db2.t2;
INSERT INTO db2.t2 SELECT * FROM db2.t2;
INSERT INTO db2.t2 SELECT * FROM db2.t2;
INSERT INTO db2.t2 SELECT * FROM db2.t2;
INSERT INTO db2.t2 SELECT * FROM db2.t2;
1. Without any compression
=============================
[hs221732@fimafeng10]/export/home2/tmp/mysql-5.1-ihb: perl innobackup hema-inno.cnf mysql-test/backup/ --socket=/export/home2/tmp/mysql-5.1-ihb/mysql-test/var/tmp/mysqld.1.sock --user=root --ibbackup=/export/home2/tmp/mysql-5.1-ihb/ibbackup
The data file size shows,
ls -lh 2010-04-27_23-43-13/
total 11M
-rw-r--r-- 1 hs221732 wheel 358 Apr 27 23:43 backup-my.cnf
drwxr-x--- 2 hs221732 wheel 4.0K Apr 27 23:43 db1
drwxr-x--- 2 hs221732 wheel 4.0K Apr 27 23:43 db2
-rw-r--r-- 1 hs221732 wheel 16 Apr 27 23:43 ibbackup_binlog_info
-rw-r----- 1 hs221732 wheel 4.0K Apr 27 23:43 ibbackup_logfile
-rw-r----- 1 hs221732 wheel 10M Apr 27 23:43 ibdata1
drwxr-xr-x 2 hs221732 wheel 4.0K Apr 27 23:43 mtr
drwxr-xr-x 2 hs221732 wheel 4.0K Apr 27 23:43 mysql
-rw-r--r-- 1 hs221732 wheel 0 Apr 27 23:43 mysql-stderr
-rw-r--r-- 1 hs221732 wheel 526 Apr 27 23:43 mysql-stdout
drwxr-xr-x 2 hs221732 wheel 4.0K Apr 27 23:43 test
2. With --compress=1
====================
perl innobackup --compress=1 hema-inno.cnf mysql-test/backup/ --socket=/export/home2/tmp/mysql-5.1-ihb/mysql-test/var/tmp/mysqld.1.sock --user=root --ibbackup=/export/home2/tmp/mysql-5.1-ihb/ibbackup
ls -lh mysql-test/backup/2010-04-27_23-47-40/ibdata1.ibz
-rw-r----- 1 hs221732 wheel 62K Apr 27 23:52 mysql-test/backup/2010-04-27_23-47-40/ibdata1.ibz
3. With --compress=0
====================
perl innobackup --compress=0 hema-inno.cnf mysql-test/backup/ --socket=/export/home2/tmp/mysql-5.1-ihb/mysql-test/var/tmp/mysqld.1.sock --user=root --ibbackup=/export/home2/tmp/mysql-5.1-ihb/ibbackup
ls -lh mysql-test/backup/2010-04-27_23-49-58/
-rw-r----- 1 hs221732 wheel 62K Apr 27 23:50 ibdata1.ibz
From the above we can notice that both --compress=0 and 1 gives the same level of compression.
Suggested fix:
Ideally there should be no compression for --compress=0 option.