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

On failure, btr_page_reorganize_low() fails to restore the old contents

    XMLWordPrintable

Details

    • Can result in data loss
    • An InnoDB page reorganize operation could corrupt things further in case it encountered corruption.

    Description

      In the function btr_page_reorganize_low(), there are several failure paths after the following:

        buf_block_t *old= buf_block_alloc();
      

      Only right before the final return DB_SUCCESS we would release the allocated block back to the buffer pool:

        buf_block_free(old);
      

      The implication is that if the page is found to be corrupted during a reorganize operation, we would leak a block that we allocated from the buffer pool. Eventually, this could lead to a hang of the server if we run out of the buffer pool.

      alessandro.vetere recently fixed this in MDEV-40408, but only for MariaDB Server 11.8 onwards. The motivation of that fix was to improve performance, not to prevent a memory leak. A minimal fix will not change the allocation but just ensure that buf_block_free(old) will be invoked in every return path.

      Furthermore, when a failure occurs, we fail to restore the contents of the page from old. We should do that in order to avoid making a bad situation worse. This follow-up to MDEV-18519 is needed to match the MySQL change Bug#37258813 btr_page_reorganize_low may cause crash recovery failure.

      Attachments

        Issue Links

          Activity

            People

              marko Marko Mäkelä
              marko Marko Mäkelä
              Marko Mäkelä Marko Mäkelä
              Alessandro Vetere Alessandro Vetere
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m

                  Git Integration

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