summaryrefslogtreecommitdiff
path: root/storage
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2017-02-22 09:17:30 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2017-02-22 09:44:21 +0200
commit6de50b2c7fd3a956ef8e32f5a76a65fd7a10969a (patch)
tree99946bfb3930b7098c2453eb53050c2707ddd2f9 /storage
parent32591b750fa52047d0b359c3fc02e9cf41631331 (diff)
downloadmariadb-git-6de50b2c7fd3a956ef8e32f5a76a65fd7a10969a.tar.gz
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
Diffstat (limited to 'storage')
-rw-r--r--storage/innobase/fil/fil0fil.c8
-rw-r--r--storage/xtradb/fil/fil0fil.c2
2 files changed, 6 insertions, 4 deletions
diff --git a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
index 195fa7adde9..d3b1d2bc1d9 100644
--- a/storage/innobase/fil/fil0fil.c
+++ b/storage/innobase/fil/fil0fil.c
@@ -4136,9 +4136,11 @@ fil_extend_space_to_desired_size(
#ifdef HAVE_POSIX_FALLOCATE
if (srv_use_posix_fallocate) {
- ib_int64_t start_offset = start_page_no * page_size;
- ib_int64_t end_offset = (size_after_extend - start_page_no) * page_size;
- ib_int64_t desired_size = size_after_extend*page_size;
+
+ ib_int64_t start_offset
+ = (start_page_no - file_start_page_no) * page_size;
+ ib_int64_t end_offset
+ = (size_after_extend - file_start_page_no) * page_size;
int err = posix_fallocate(
node->handle, start_offset, end_offset);
diff --git a/storage/xtradb/fil/fil0fil.c b/storage/xtradb/fil/fil0fil.c
index 3f9103c521f..51491275ef6 100644
--- a/storage/xtradb/fil/fil0fil.c
+++ b/storage/xtradb/fil/fil0fil.c
@@ -4973,7 +4973,7 @@ fil_extend_space_to_desired_size(
if (srv_use_posix_fallocate) {
ib_int64_t start_offset
- = file_start_page_no * page_size;
+ = (start_page_no - file_start_page_no) * page_size;
ib_int64_t end_offset
= (size_after_extend - file_start_page_no) * page_size;
int err = posix_fallocate(