Skip to content

Commit 6de50b2

Browse files
committed
MDEV-11520 post-fixes
Remove the unused variable desired_size. Also, correct the expression for the posix_fallocate() start_offset, and actually test that it works with a multi-file system tablespace. Before MDEV-11520, the expression was wrong in both innodb_plugin and xtradb, in different ways. The start_offset formula was tested with the following: ./mtr --big-test --mysqld=--innodb-use-fallocate \ --mysqld=--innodb-data-file-path='ibdata1:5M;ibdata2:5M:autoextend' \ --parallel=auto --force --retry=0 --suite=innodb & ls -lsh mysql-test/var/*/mysqld.1/data/ibdata2
1 parent 32591b7 commit 6de50b2

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

storage/innobase/fil/fil0fil.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4136,9 +4136,11 @@ fil_extend_space_to_desired_size(
41364136

41374137
#ifdef HAVE_POSIX_FALLOCATE
41384138
if (srv_use_posix_fallocate) {
4139-
ib_int64_t start_offset = start_page_no * page_size;
4140-
ib_int64_t end_offset = (size_after_extend - start_page_no) * page_size;
4141-
ib_int64_t desired_size = size_after_extend*page_size;
4139+
4140+
ib_int64_t start_offset
4141+
= (start_page_no - file_start_page_no) * page_size;
4142+
ib_int64_t end_offset
4143+
= (size_after_extend - file_start_page_no) * page_size;
41424144
int err = posix_fallocate(
41434145
node->handle, start_offset, end_offset);
41444146

storage/xtradb/fil/fil0fil.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4973,7 +4973,7 @@ fil_extend_space_to_desired_size(
49734973
if (srv_use_posix_fallocate) {
49744974

49754975
ib_int64_t start_offset
4976-
= file_start_page_no * page_size;
4976+
= (start_page_no - file_start_page_no) * page_size;
49774977
ib_int64_t end_offset
49784978
= (size_after_extend - file_start_page_no) * page_size;
49794979
int err = posix_fallocate(

0 commit comments

Comments
 (0)