Details

    Description

      When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

      MariaDB 10.4 introduced an InnoDB redo log record MLOG_INIT_FREE_PAGE for marking pages as freed. In MDEV-12353 (MariaDB 10.5.2), that record was replaced with FREE_PAGE. This record could be treated as no-op, or we can punch a hole for page_compressed=1 tables.

      If innodb_immediate_scrub_data_uncompressed is set, we should initialize the page with zeros. This will replace some of the non-working scrubbing logic (MDEV-8139). The scrubbing will be fixed further in MDEV-8139.

      The following parameters will be deprecated and ignored and the problematic ‘background scrubbing’ code removed:

      • innodb-background-scrub-data-uncompressed
      • innodb-background-scrub-data-compressed
      • innodb-background-scrub-data-interval
      • innodb-background-scrub-data-check-interval

      For page_compressed tables the freed page will be hole-punched

      Attachments

        Issue Links

          Activity

            marko Marko Mäkelä created issue -
            marko Marko Mäkelä made changes -
            Field Original Value New Value
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Status Open [ 1 ] Confirmed [ 10101 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -

            MariaDB 10.4.3 will introduce a MLOG_INIT_FREE_PAGE record for this purpose. This allows this bug to be fixed in MariaDB 10.4 later without breaking crash-downgrade to earlier MariaDB 10.4 versions.

            In MDEV-12699, MLOG_INIT_FREE_PAGE should be handled in a similar way as the existing record MLOG_INIT_FILE_PAGE2.

            marko Marko Mäkelä added a comment - MariaDB 10.4.3 will introduce a MLOG_INIT_FREE_PAGE record for this purpose. This allows this bug to be fixed in MariaDB 10.4 later without breaking crash-downgrade to earlier MariaDB 10.4 versions. In MDEV-12699 , MLOG_INIT_FREE_PAGE should be handled in a similar way as the existing record MLOG_INIT_FILE_PAGE2 .
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.3 [ 22126 ]
            marko Marko Mäkelä made changes -
            NRE Projects RM_105_CANDIDATE RM_104ES_CANDIDATE

            I think that this is realistic to do in the 10.4 time frame. Assigning to myself, because this is closely related to MDEV-12699, which I am working on.

            marko Marko Mäkelä added a comment - I think that this is realistic to do in the 10.4 time frame. Assigning to myself, because this is closely related to MDEV-12699 , which I am working on.
            marko Marko Mäkelä made changes -
            Assignee Thirunarayanan Balathandayuthapani [ thiru ] Marko Mäkelä [ marko ]

            When scrubbing is not enabled and the page is not on SSD and the file is not page_compressed, we can discard the page from the buf_pool->flush_list once the MLOG_INIT_FREE_PAGE record has been written. For scrubbing, it is kind of mandatory to initialize the page.

            For non-compressed tables on SSD, we will have to evaluate whether punching holes is going to improve or hurt performance on the average.

            marko Marko Mäkelä added a comment - When scrubbing is not enabled and the page is not on SSD and the file is not page_compressed , we can discard the page from the buf_pool->flush_list once the MLOG_INIT_FREE_PAGE record has been written. For scrubbing, it is kind of mandatory to initialize the page. For non-compressed tables on SSD, we will have to evaluate whether punching holes is going to improve or hurt performance on the average.
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Description When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

            We should introduce an InnoDB redo log record for marking pages as freed. This record, say, {{MLOG_PAGE_FREE}}, could be treated as no-op, or we could elect to punch a hole, especially when the {{page_compressed=1}} option is used.

            If scrubbing is enabled, we should initialize the page with zeros. This should replace some of the non-working scrubbing logic (MDEV-8139).
            When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

            We should introduce an InnoDB redo log record for marking pages as freed. This record, {{MLOG_INIT_FREE_PAGE}}, could be treated as no-op, or we could elect to punch a hole, especially when the {{page_compressed=1}} option is used.

            If scrubbing is enabled, we should initialize the page with zeros. This should replace some of the non-working scrubbing logic (MDEV-8139).
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5 [ 23123 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            Assignee Marko Mäkelä [ marko ] Thirunarayanan Balathandayuthapani [ thiru ]
            thiru Thirunarayanan Balathandayuthapani made changes -
            Status Confirmed [ 10101 ] In Progress [ 3 ]
            marko Marko Mäkelä made changes -

            As part of this, we should simplify the freeing of B-tree root pages:

            diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc
            index 753ed9b077c..21609edb7f3 100644
            --- a/storage/innobase/btr/btr0btr.cc
            +++ b/storage/innobase/btr/btr0btr.cc
            @@ -961,12 +961,9 @@ constexpr index_id_t	BTR_FREED_INDEX_ID = 0;
             
             /** Free a B-tree root page. btr_free_but_not_root() must already
             have been called.
            -In a persistent tablespace, the caller must invoke fsp_init_file_page()
            -before mtr.commit().
             @param[in,out]	block		index root page
            -@param[in,out]	mtr		mini-transaction
            -@param[in]	invalidate	whether to invalidate PAGE_INDEX_ID */
            -static void btr_free_root(buf_block_t *block, mtr_t *mtr, bool invalidate)
            +@param[in,out]	mtr		mini-transaction */
            +static void btr_free_root(buf_block_t *block, mtr_t *mtr)
             {
               ut_ad(mtr_memo_contains_flagged(mtr, block,
             				  MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX));
            

            (Obviously, also the code inside if (invalidate) should be removed and the callers be adjusted.)
            We should ensure that MLOG_INIT_FREE_PAGE records will be emitted by fseg_free_step(), and thus no log needs to be written in this function.

            marko Marko Mäkelä added a comment - As part of this, we should simplify the freeing of B-tree root pages: diff --git a/storage/innobase/btr/btr0btr.cc b/storage/innobase/btr/btr0btr.cc index 753ed9b077c..21609edb7f3 100644 --- a/storage/innobase/btr/btr0btr.cc +++ b/storage/innobase/btr/btr0btr.cc @@ -961,12 +961,9 @@ constexpr index_id_t BTR_FREED_INDEX_ID = 0; /** Free a B-tree root page. btr_free_but_not_root() must already have been called. -In a persistent tablespace, the caller must invoke fsp_init_file_page() -before mtr.commit(). @param[in,out] block index root page -@param[in,out] mtr mini-transaction -@param[in] invalidate whether to invalidate PAGE_INDEX_ID */ -static void btr_free_root(buf_block_t *block, mtr_t *mtr, bool invalidate) +@param[in,out] mtr mini-transaction */ +static void btr_free_root(buf_block_t *block, mtr_t *mtr) { ut_ad(mtr_memo_contains_flagged(mtr, block, MTR_MEMO_PAGE_X_FIX | MTR_MEMO_PAGE_SX_FIX)); (Obviously, also the code inside if (invalidate) should be removed and the callers be adjusted.) We should ensure that MLOG_INIT_FREE_PAGE records will be emitted by fseg_free_step() , and thus no log needs to be written in this function.
            serg Sergei Golubchik made changes -
            Fix Version/s 10.5 [ 23123 ]
            Fix Version/s 10.4 [ 22408 ]

            This looks OK to me, after addressing my feedback for commit 1 of 2. We will address the following later, ideally before the 10.5 GA release:

            • clean up btr_free_root() as I suggested in my previous comment
            • address the FIXME comments in buf_page_free() by introducing a data structure that covers freed page ranges also for pages that are not in the buffer pool, and enable the scrubbing tests (MDEV-8139)
            marko Marko Mäkelä added a comment - This looks OK to me, after addressing my feedback for commit 1 of 2 . We will address the following later, ideally before the 10.5 GA release: clean up btr_free_root() as I suggested in my previous comment address the FIXME comments in buf_page_free() by introducing a data structure that covers freed page ranges also for pages that are not in the buffer pool, and enable the scrubbing tests ( MDEV-8139 )

            commit a5584b13d1e04f38b843602413669591aa65c359 (HEAD -> 10.5, origin/10.5, 10.5-work)
            Author: Thirunarayanan Balathandayuthapani <thiru@mariadb.com>
            Date:   Tue Mar 10 10:47:24 2020 +0530
             
            commit a35b4ae89871d8184f04abb112c385481d557dbb
            Author: Thirunarayanan Balathandayuthapani <thiru@mariadb.com>
            Date:   Mon Mar 9 13:25:33 2020 +0530
             
                MDEV-15528 Punch holes when pages are freed
            

            Patch has been pushed to 10.5. Thanks to marko and @matthias.leich for testing abd reviewing it

            thiru Thirunarayanan Balathandayuthapani added a comment - commit a5584b13d1e04f38b843602413669591aa65c359 (HEAD -> 10.5, origin/10.5, 10.5-work) Author: Thirunarayanan Balathandayuthapani <thiru@mariadb.com> Date: Tue Mar 10 10:47:24 2020 +0530   commit a35b4ae89871d8184f04abb112c385481d557dbb Author: Thirunarayanan Balathandayuthapani <thiru@mariadb.com> Date: Mon Mar 9 13:25:33 2020 +0530   MDEV-15528 Punch holes when pages are freed Patch has been pushed to 10.5. Thanks to marko and @matthias.leich for testing abd reviewing it
            thiru Thirunarayanan Balathandayuthapani made changes -
            Fix Version/s 10.5.2 [ 24030 ]
            Fix Version/s 10.5 [ 23123 ]
            Resolution Fixed [ 1 ]
            Status In Progress [ 3 ] Closed [ 6 ]
            marko Marko Mäkelä made changes -
            Description When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

            We should introduce an InnoDB redo log record for marking pages as freed. This record, {{MLOG_INIT_FREE_PAGE}}, could be treated as no-op, or we could elect to punch a hole, especially when the {{page_compressed=1}} option is used.

            If scrubbing is enabled, we should initialize the page with zeros. This should replace some of the non-working scrubbing logic (MDEV-8139).
            When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

            MariaDB 10.4 introduced an InnoDB redo log record {{MLOG_INIT_FREE_PAGE}} for marking pages as freed. In MDEV-12353 (MariaDB 10.5.2), that record was replaced with {{FREE_PAGE}}. This record could be treated as no-op, or we can punch a hole for {{page_compressed=1}} tables.

            If {{innodb_immediate_scrub_data_uncompressed}} is set, we should initialize the page with zeros. This will replace some of the non-working scrubbing logic (MDEV-8139). The scrubbing will be fixed further in MDEV-8139.

            The following parameters will be deprecated and ignored and the problematic ‘background scrubbing’ code removed:
            * innodb-background-scrub-data-uncompressed
            * innodb-background-scrub-data-compressed
            * innodb-background-scrub-data-interval
            * innodb-background-scrub-data-check-interval
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            monty Michael Widenius made changes -
            Summary Punch holes when pages are freed Avoid writing freed InnoDB pages
            monty Michael Widenius made changes -
            Description When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

            MariaDB 10.4 introduced an InnoDB redo log record {{MLOG_INIT_FREE_PAGE}} for marking pages as freed. In MDEV-12353 (MariaDB 10.5.2), that record was replaced with {{FREE_PAGE}}. This record could be treated as no-op, or we can punch a hole for {{page_compressed=1}} tables.

            If {{innodb_immediate_scrub_data_uncompressed}} is set, we should initialize the page with zeros. This will replace some of the non-working scrubbing logic (MDEV-8139). The scrubbing will be fixed further in MDEV-8139.

            The following parameters will be deprecated and ignored and the problematic ‘background scrubbing’ code removed:
            * innodb-background-scrub-data-uncompressed
            * innodb-background-scrub-data-compressed
            * innodb-background-scrub-data-interval
            * innodb-background-scrub-data-check-interval
            When a InnoDB data file page is freed, its contents becomes garbage, and any storage allocated in the data file is wasted.

            MariaDB 10.4 introduced an InnoDB redo log record {{MLOG_INIT_FREE_PAGE}} for marking pages as freed. In MDEV-12353 (MariaDB 10.5.2), that record was replaced with {{FREE_PAGE}}. This record could be treated as no-op, or we can punch a hole for {{page_compressed=1}} tables.

            If {{innodb_immediate_scrub_data_uncompressed}} is set, we should initialize the page with zeros. This will replace some of the non-working scrubbing logic (MDEV-8139). The scrubbing will be fixed further in MDEV-8139.

            The following parameters will be deprecated and ignored and the problematic ‘background scrubbing’ code removed:
            * innodb-background-scrub-data-uncompressed
            * innodb-background-scrub-data-compressed
            * innodb-background-scrub-data-interval
            * innodb-background-scrub-data-check-interval

            For page_compressed tables the freed page will be hole-punched
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            serg Sergei Golubchik made changes -
            Workflow MariaDB v3 [ 85945 ] MariaDB v4 [ 153930 ]
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            thiru Thirunarayanan Balathandayuthapani made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            marko Marko Mäkelä made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -
            rob.schwyzer@mariadb.com Rob Schwyzer (Inactive) made changes -

            People

              thiru Thirunarayanan Balathandayuthapani
              marko Marko Mäkelä
              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.