[MDEV-12075] innodb_use_fallocate does not work in MariaDB Server 10.1.21 Created: 2017-02-16  Updated: 2020-08-25  Resolved: 2017-02-16

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.1.21
Fix Version/s: 10.1.22

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: regression
Environment:

GNU/Linux (HAVE_POSIX_FALLOCATE)


Issue Links:
Duplicate
is duplicated by MDEV-12027 posix_fallocate returned OS error 201. Closed
Problem/Incident
is caused by MDEV-11556 InnoDB redo log apply fails to adjust... Closed

 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.



 Comments   
Comment by Marko Mäkelä [ 2017-02-16 ]

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;
 		const os_offset_t len		= static_cast<os_offset_t>(

Comment by Jan Lindström (Inactive) [ 2017-02-16 ]

ok to push.

Generated at Thu Feb 08 07:54:55 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.