I am still not seeing any difference in on-disk file size for compressed/uncompressed files. This is with statistics being reported as compression having been done when a compressed table is compressed.
I tried with stock 10.1.7 from the repository, as well as a freshly compiled 10.1.7 & 10.1.6 with lz4 compression with the same results. Also this was done with a completely fresh set of db files for each version.
Relevant config from my.cnf :
{{## Page compression setup:
innodb_use_fallocate=ON
innodb_file_format=barracuda
innodb_compression_level=6
innodb_compression_algorithm=lz4
[mariadb]
innodb_mtflush_threads=4
innodb_use_mtflush=1}}
Reproduction steps :
- After installation from source, create and start new server with new test db :
{{rm -Rf /var/lib/mysql && cd /usr/local/mysql && /usr/local/mysql/scripts/mysql_install_db --basedir=/usr/local/mysql/
cd /usr/local/mysql && /usr/local/mysql/bin/mysqld_safe --datadir=/var/lib/mysql
mysqladmin -uroot create t}}
- Create some data :
{{create table a(c int not null default 0,t char(255) not null default '') engine=innodb;insert into a VALUES(912312,'asdljkashdkhqgerhwvqefasqeldkjasdljadkljasdasdd');
MariaDB [t]> insert into a select * from a;
...
repeat
...
MariaDB [t]> insert into a select * from a;
Query OK, 32768 rows affected (0.14 sec)
Records: 32768 Duplicates: 0 Warnings: 0}}
- Insert into page compressed table :
create table b(c int not null default 0,t char(255) not null default '') page_compressed=1 engine=innodb;insert into b select * from a;
- DB status says compression took place and saved quite a bit of data :
{{# mysql -uroot -e "show status" | egrep 'Innodb_page_compression_saved|Innodb_num_pages_page_compressed'
Innodb_page_compression_saved 15220736
Innodb_num_pages_page_compressed 1240}}
- Look at files on filesystem though, and storage is identical :
{{# ls -la /var/lib/mysql/t/*.ibd
rw-rw--- 1 mysql mysql 28311552 Oct 5 23:45 /var/lib/mysql/t/a.ibd
rw-rw--- 1 mysql mysql 28311552 Oct 5 23:45 /var/lib/mysql/t/b.ibd}}
commit f7002c05ae4e4a09bc6859ccc568064cfd6bb268
Author: Jan Lindström <jan.lindstrom@mariadb.com>
Date: Wed Jun 3 13:10:18 2015 +0300
MDEV-8250: InnoDB: Page compressed tables are not compressed and compressed+encrypted tables cause crashAnalysis: Problem is that both encrypted tables and compressed tables use
FIL header offset FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION to store
required metadata. Furhermore, for only compressed tables currently
code skips compression.
Fixes:
no need to fix
no need to fix as they have different page type FIL_PAGE_PAGE_COMPRESSED
key_version is stored on FIL header offset FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION and compression
method is stored after FIL header similar way as compressed size, so that first
FIL_PAGE_COMPRESSED_SIZE is stored followed by FIL_PAGE_COMPRESSION_METHOD