Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.1.21
-
GNU/Linux (HAVE_POSIX_FALLOCATE)
Description
The InnoDB data file extension code that was refactored in MDEV-11556 fails to extend any data files when innodb_use_fallocate=ON. Even the mysql-test-run bootstrap fails:
./mtr --mysqld=--innodb-use-fallocate --suite=innodb
|
2017-02-16 9:41:06 139742722718464 [ERROR] InnoDB: preallocating file space for file './mysql/innodb_table_stats.ibd' failed. Current size 65536, desired size 65536
|
In MDEV-11687 (MariaDB Server 10.2.4) the parameter innodb_use_fallocate was deprecated, because posix_fallocate() will always be used when available. So, this regression only affects MariaDB Server 10.1.21.
Attachments
Issue Links
- is caused by
-
MDEV-11556 InnoDB redo log apply fails to adjust data file sizes
-
- Closed
-
- is duplicated by
-
MDEV-12027 posix_fallocate returned OS error 201.
-
- Closed
-
The fix is simple:
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index 6f522528d42..83e2fc8052a 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -1054,6 +1054,8 @@ fil_space_extend_must_retry(
? OS_FILE_READ : OS_FILE_WRITE;
if (srv_use_posix_fallocate) {
+ pages_added = size - space->size;
+
const os_offset_t start_offset = static_cast<os_offset_t>(
start_page_no) * page_size;
const os_offset_t len = static_cast<os_offset_t>(
diff --git a/storage/xtradb/fil/fil0fil.cc b/storage/xtradb/fil/fil0fil.cc
index e56b3c0a160..884314352e8 100644
--- a/storage/xtradb/fil/fil0fil.cc
+++ b/storage/xtradb/fil/fil0fil.cc
@@ -1059,6 +1059,8 @@ fil_space_extend_must_retry(
? OS_FILE_READ : OS_FILE_WRITE;
if (srv_use_posix_fallocate) {
+ pages_added = size - space->size;
+
const os_offset_t start_offset = static_cast<os_offset_t>(
start_page_no) * page_size;