Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-12075

innodb_use_fallocate does not work in MariaDB Server 10.1.21

Details

    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

          Activity

            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>(
            

            marko Marko Mäkelä added a comment - 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>(

            ok to push.

            jplindst Jan Lindström (Inactive) added a comment - ok to push.

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.