From c1fc59277a98149123d0feb6917b8d6850aa1033 Mon Sep 17 00:00:00 2001 From: Vladislav Vaintroub Date: Tue, 15 Oct 2024 18:54:53 +0200 Subject: [PATCH] MDEV-34929 page-compressed tables do not work on Windows Remove workaround for MDEV-13941, it served for 5 years,and all affected pre-release 10.2 installation should have been already fixed in between. Apparently Innodb is using is_sparse parameter in os_file_set_size() inconsistently, and it passes is_sparse=false now during first file extension. With MDEV-13941 workaround in place, it would unsparse the file, which is makes compression not to work at all anymore. --- .../innodb/r/page_compression_windows.result | 6 ++++++ .../suite/innodb/t/page_compression_windows.opt | 1 + .../suite/innodb/t/page_compression_windows.test | 7 +++++++ storage/innobase/os/os0file.cc | 16 +--------------- 4 files changed, 15 insertions(+), 15 deletions(-) create mode 100644 mysql-test/suite/innodb/r/page_compression_windows.result create mode 100644 mysql-test/suite/innodb/t/page_compression_windows.opt create mode 100644 mysql-test/suite/innodb/t/page_compression_windows.test diff --git a/mysql-test/suite/innodb/r/page_compression_windows.result b/mysql-test/suite/innodb/r/page_compression_windows.result new file mode 100644 index 00000000000..229050db913 --- /dev/null +++ b/mysql-test/suite/innodb/r/page_compression_windows.result @@ -0,0 +1,6 @@ +create table t_compressed(b longblob) engine=InnoDB page_compressed=1; +insert into t_compressed values(repeat(1,1000000)); +select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed'; +allocated_size < file_size +1 +drop table t_compressed; diff --git a/mysql-test/suite/innodb/t/page_compression_windows.opt b/mysql-test/suite/innodb/t/page_compression_windows.opt new file mode 100644 index 00000000000..66bceccc683 --- /dev/null +++ b/mysql-test/suite/innodb/t/page_compression_windows.opt @@ -0,0 +1 @@ +--innodb-sys-tablespaces diff --git a/mysql-test/suite/innodb/t/page_compression_windows.test b/mysql-test/suite/innodb/t/page_compression_windows.test new file mode 100644 index 00000000000..4400afd6171 --- /dev/null +++ b/mysql-test/suite/innodb/t/page_compression_windows.test @@ -0,0 +1,7 @@ +--source include/have_innodb.inc +--source include/windows.inc +create table t_compressed(b longblob) engine=InnoDB page_compressed=1; +insert into t_compressed values(repeat(1,1000000)); +# Check that compression worked, i.e allocated size (physical file size) < logical file size +select allocated_size < file_size from information_schema.innodb_sys_tablespaces where name='test/t_compressed'; +drop table t_compressed; diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index beaf2c172d7..6134a44b771 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -3210,22 +3210,8 @@ os_file_set_size( #ifdef _WIN32 /* On Windows, changing file size works well and as expected for both - sparse and normal files. - - However, 10.2 up until 10.2.9 made every file sparse in innodb, - causing NTFS fragmentation issues(MDEV-13941). We try to undo - the damage, and unsparse the file.*/ - - if (!is_sparse && os_is_sparse_file_supported(file)) { - if (!os_file_set_sparse_win32(file, false)) - /* Unsparsing file failed. Fallback to writing binary - zeros, to avoid even higher fragmentation.*/ - goto fallback; - } - + sparse and normal files. */ return os_file_change_size_win32(name, file, size); - -fallback: #else struct stat statbuf;