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

InnoDB redo log apply fails to adjust data file sizes

Details

    • 10.2.4-5

    Description

      Prepare of partial backup (with --tables option) sporadically fails with following error :

      InnoDB: Error: tablespace size stored in header is 4864 pages, but
      InnoDB: the sum of data file sizes is only 768 pages
      InnoDB: Cannot start InnoDB. The tail of the system tablespace is
      InnoDB: missing.

      Attached are:
      test_partial_uncommitted.sh - test which reliably demonstrates the problem in my environment
      test_partial_uncommitted.log - corresponding log
      my.cnf - config used
      partial_uncommitted.test 'identical' mtr test, which DOES NOT demonstrate the problem (for unknown reasons (generated xtrabackup_info and backup-my.cnf are identical to .sh test).

      Interesting observation is that all tables are backed up - this should be another bug eventually if not fixed as part of this.

      Attachments

        1. my.cnf
          0.3 kB
        2. partial_uncommitted.test
          0.5 kB
        3. problem.tar.gz
          8.89 MB
        4. test_partial_uncommitted.log
          25 kB
        5. test_partial_uncommitted.sh
          0.7 kB

        Issue Links

          Activity

            The remaining problem was solved by removing some inappropriate rounding of the InnoDB system tablespace size:

            diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc
            index 8b04b51ce0b..34fb1f87bdf 100644
            --- a/storage/xtradb/srv/srv0start.cc
            +++ b/storage/xtradb/srv/srv0start.cc
            @@ -192,9 +192,6 @@ static const ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES =
             #define SRV_N_PENDING_IOS_PER_THREAD	OS_AIO_N_PENDING_IOS_PER_THREAD
             #define SRV_MAX_N_PENDING_SYNC_IOS	100
             
            -/** The round off to MB is similar as done in srv_parse_megabytes() */
            -#define CALC_NUMBER_OF_PAGES(size)  ((size) / (1024 * 1024)) * \
            -				  ((1024 * 1024) / (UNIV_PAGE_SIZE))
             #ifdef UNIV_PFS_THREAD
             /* Keys to register InnoDB threads with performance schema */
             UNIV_INTERN mysql_pfs_key_t	io_handler_thread_key;
            @@ -1029,15 +1026,12 @@ open_or_create_data_files(
             			size = os_file_get_size(files[i]);
             			ut_a(size != (os_offset_t) -1);
             
            -			/* Under some error conditions like disk full
            -			narios or file size reaching filesystem
            -			limit the data file could contain an incomplete
            -			extent at the end. When we extend a data file
            -			and if some failure happens, then also the data
            -			file could contain an incomplete extent.  So we
            -			need to round the size downward to a megabyte.*/
            +			/* If InnoDB encountered an error or was killed
            +			while extending the data file, the last page
            +			could be incomplete. */
             
            -			rounded_size_pages = (ulint) CALC_NUMBER_OF_PAGES(size);
            +			rounded_size_pages = static_cast<ulint>(
            +				size >> UNIV_PAGE_SIZE_SHIFT);
             
             			if (i == srv_n_data_files - 1
             			    && srv_auto_extend_last_data_file) {
            

            marko Marko Mäkelä added a comment - The remaining problem was solved by removing some inappropriate rounding of the InnoDB system tablespace size: diff --git a/storage/xtradb/srv/srv0start.cc b/storage/xtradb/srv/srv0start.cc index 8b04b51ce0b..34fb1f87bdf 100644 --- a/storage/xtradb/srv/srv0start.cc +++ b/storage/xtradb/srv/srv0start.cc @@ -192,9 +192,6 @@ static const ulint SRV_UNDO_TABLESPACE_SIZE_IN_PAGES = #define SRV_N_PENDING_IOS_PER_THREAD OS_AIO_N_PENDING_IOS_PER_THREAD #define SRV_MAX_N_PENDING_SYNC_IOS 100 -/** The round off to MB is similar as done in srv_parse_megabytes() */ -#define CALC_NUMBER_OF_PAGES(size) ((size) / (1024 * 1024)) * \ - ((1024 * 1024) / (UNIV_PAGE_SIZE)) #ifdef UNIV_PFS_THREAD /* Keys to register InnoDB threads with performance schema */ UNIV_INTERN mysql_pfs_key_t io_handler_thread_key; @@ -1029,15 +1026,12 @@ open_or_create_data_files( size = os_file_get_size(files[i]); ut_a(size != (os_offset_t) -1); - /* Under some error conditions like disk full - narios or file size reaching filesystem - limit the data file could contain an incomplete - extent at the end. When we extend a data file - and if some failure happens, then also the data - file could contain an incomplete extent. So we - need to round the size downward to a megabyte.*/ + /* If InnoDB encountered an error or was killed + while extending the data file, the last page + could be incomplete. */ - rounded_size_pages = (ulint) CALC_NUMBER_OF_PAGES(size); + rounded_size_pages = static_cast<ulint>( + size >> UNIV_PAGE_SIZE_SHIFT); if (i == srv_n_data_files - 1 && srv_auto_extend_last_data_file) {

            ok to push.

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

            I repushed once more to bb-10.1-mdev-11556. There was a bug in my test file that caused it to fail when run against a non-debug server.

            marko Marko Mäkelä added a comment - I repushed once more to bb-10.1-mdev-11556. There was a bug in my test file that caused it to fail when run against a non-debug server.

            I pushed this to 10.1 and am now working on the merge to 10.2.

            marko Marko Mäkelä added a comment - I pushed this to 10.1 and am now working on the merge to 10.2.

            I did not merge this correctly to MariaDB 10.2. A follow-up adjustment will fix MDEV-18194.

            marko Marko Mäkelä added a comment - I did not merge this correctly to MariaDB 10.2. A follow-up adjustment will fix MDEV-18194 .

            People

              marko Marko Mäkelä
              anikitin Andrii Nikitin (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 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.