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

InnoDB wrongly ignores the end of an .ibd file

Details

    Description

      The test innodb.innodb-64k-crash is crashing in recovery due to a wrongly reported out-of-bounds page access:

      2017-02-08 10:45:40 140342763513024 [Note] InnoDB: Waiting for purge to start
      InnoDB: Error: trying to access page number 2 in space 5,
      InnoDB: space name test/t2,
      InnoDB: which is outside the tablespace bounds.
      

      The tablespace file in question has FSP_SIZE=21 which corresponds to the file size 21*16384 pages. The error message above is misleading, because it is not really about accessing page 2, but accessing page space->size+2. The issue is that InnoDB wrongly truncated the space->size to 16. The fix is to remove that bogus truncation:

      diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
      index 97e70645636..949907af597 100644
      --- a/storage/innobase/fil/fil0fil.cc
      +++ b/storage/innobase/fil/fil0fil.cc
      @@ -692,11 +692,6 @@ fil_node_open_file(
       			return(false);
       		}
       
      -		if (size_bytes >= (1024*1024)) {
      -			/* Truncate the size to whole extent size. */
      -			size_bytes = ut_2pow_round(size_bytes, (1024*1024));
      -		}
      -
       		if (!fsp_flags_is_compressed(flags)) {
       			node->size = (ulint) (size_bytes / UNIV_PAGE_SIZE);
       		} else {
      

      Attachments

        Issue Links

          Activity

            Note: In MySQL 5.7 (which was the first MySQL version to support innodb_page_size=32k or innodb_page_size=64k, in WL#5757) the extent size is 2 MiB for innodb_page_size=32k and 4 MiB for innodb_page_size=64k. See for example dict_table_extent_size() and the macro definition:

            #define FSP_EXTENT_SIZE         ((UNIV_PAGE_SIZE <= (16384) ?	\
            				(1048576 / UNIV_PAGE_SIZE) :	\
            				((UNIV_PAGE_SIZE <= (32768)) ?	\
            				(2097152 / UNIV_PAGE_SIZE) :	\
            				(4194304 / UNIV_PAGE_SIZE))))
            

            That said, I do not see any point in ignoring the end of the file when opening a file. MDEV-11556 already made file size extension crash-safe.

            marko Marko Mäkelä added a comment - Note: In MySQL 5.7 (which was the first MySQL version to support innodb_page_size=32k or innodb_page_size=64k, in WL#5757 ) the extent size is 2 MiB for innodb_page_size=32k and 4 MiB for innodb_page_size=64k. See for example dict_table_extent_size() and the macro definition: #define FSP_EXTENT_SIZE ((UNIV_PAGE_SIZE <= (16384) ? \ (1048576 / UNIV_PAGE_SIZE) : \ ((UNIV_PAGE_SIZE <= (32768)) ? \ (2097152 / UNIV_PAGE_SIZE) : \ (4194304 / UNIV_PAGE_SIZE)))) That said, I do not see any point in ignoring the end of the file when opening a file. MDEV-11556 already made file size extension crash-safe.

            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.