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

Replace FSP_FLAGS_HAS_PAGE_COMPRESSION with fil_space_t::is_compressed

Details

    Description

      InnoDB should replace FSP_FLAGS_HAS_PAGE_COMPRESSION with fil_space_t::is_compressed(). fil_space_t::is_compressed() checks for both non full crc32 and
      crc32 format.

      Attachments

        Issue Links

          Activity

            The following patch does that:

            diff --git a/extra/mariabackup/ds_local.cc b/extra/mariabackup/ds_local.cc
            index fb2ea0a1629..85609e870a9 100644
            --- a/extra/mariabackup/ds_local.cc
            +++ b/extra/mariabackup/ds_local.cc
            @@ -180,7 +180,7 @@ static void init_ibd_data(ds_local_file_t *local_file, const uchar *buf, size_t
                    local_file->pagesize= ssize == 0 ? UNIV_PAGE_SIZE_ORIG : ((UNIV_ZIP_SIZE_MIN >> 1) << ssize);
                    local_file->compressed = fil_space_t::full_crc32(flags)
                            ? fil_space_t::is_compressed(flags)
            -               : bool(FSP_FLAGS_HAS_PAGE_COMPRESSION(flags));
            +               : bool(fil_space_t::is_compressed(flags));
             #if defined(_WIN32) && (MYSQL_VERSION_ID > 100200)
                    /* Make compressed file sparse, on Windows.
            diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
            index e77cda3af0b..e02207e303e 100644
            --- a/storage/innobase/fil/fil0fil.cc
            +++ b/storage/innobase/fil/fil0fil.cc
            @@ -845,7 +845,7 @@ fil_space_extend_must_retry(
                            os_offset_t(FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift));
                    *success = os_file_set_size(node->name, node->handle, new_size,
            -               FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags));
            +                                   fil_space_t::is_compressed(space->flags));
                    os_has_said_disk_full = *success;
                    if (*success) {
            @@ -2935,7 +2935,7 @@ fil_ibd_create(
                            return NULL;
                    }
            -       const bool is_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(flags);
            +       const bool is_compressed = fil_space_t::is_compressed(flags);
                    bool punch_hole = is_compressed;
             #ifdef _WIN32
            @@ -3764,7 +3764,7 @@ fil_ibd_load(
                    /* Adjust the memory-based flags that would normally be set by
                    dict_tf_to_fsp_flags(). In recovery, we have no data dictionary. */
                    ulint flags = file.flags();
            -       if (FSP_FLAGS_HAS_PAGE_COMPRESSION(flags)) {
            +       if (fil_space_t::is_compressed(flags)) {
                            flags |= page_zip_level
                                    << FSP_FLAGS_MEM_COMPRESSION_LEVEL;
                    }
            

            thiru Thirunarayanan Balathandayuthapani added a comment - The following patch does that: diff --git a/extra/mariabackup/ds_local.cc b/extra/mariabackup/ds_local.cc index fb2ea0a1629..85609e870a9 100644 --- a/extra/mariabackup/ds_local.cc +++ b/extra/mariabackup/ds_local.cc @@ -180,7 +180,7 @@ static void init_ibd_data(ds_local_file_t *local_file, const uchar *buf, size_t local_file->pagesize= ssize == 0 ? UNIV_PAGE_SIZE_ORIG : ((UNIV_ZIP_SIZE_MIN >> 1) << ssize); local_file->compressed = fil_space_t::full_crc32(flags) ? fil_space_t::is_compressed(flags) - : bool(FSP_FLAGS_HAS_PAGE_COMPRESSION(flags)); + : bool(fil_space_t::is_compressed(flags)); #if defined(_WIN32) && (MYSQL_VERSION_ID > 100200) /* Make compressed file sparse, on Windows. diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc index e77cda3af0b..e02207e303e 100644 --- a/storage/innobase/fil/fil0fil.cc +++ b/storage/innobase/fil/fil0fil.cc @@ -845,7 +845,7 @@ fil_space_extend_must_retry( os_offset_t(FIL_IBD_FILE_INITIAL_SIZE << srv_page_size_shift)); *success = os_file_set_size(node->name, node->handle, new_size, - FSP_FLAGS_HAS_PAGE_COMPRESSION(space->flags)); + fil_space_t::is_compressed(space->flags)); os_has_said_disk_full = *success; if (*success) { @@ -2935,7 +2935,7 @@ fil_ibd_create( return NULL; } - const bool is_compressed = FSP_FLAGS_HAS_PAGE_COMPRESSION(flags); + const bool is_compressed = fil_space_t::is_compressed(flags); bool punch_hole = is_compressed; #ifdef _WIN32 @@ -3764,7 +3764,7 @@ fil_ibd_load( /* Adjust the memory-based flags that would normally be set by dict_tf_to_fsp_flags(). In recovery, we have no data dictionary. */ ulint flags = file.flags(); - if (FSP_FLAGS_HAS_PAGE_COMPRESSION(flags)) { + if (fil_space_t::is_compressed(flags)) { flags |= page_zip_level << FSP_FLAGS_MEM_COMPRESSION_LEVEL; }

            fil_space_t::is_compressed(space->flags)) can better be written as space->is_compressed(). I do not think that any change is needed in extra/mariabackup/ds_local.cc because the code is in the branch where fil_space_t::full_crc32(flags) does not hold.

            OK to push to 10.4 with that revision. I tested the patch on 10.5.

            marko Marko Mäkelä added a comment - fil_space_t::is_compressed(space->flags)) can better be written as space->is_compressed() . I do not think that any change is needed in extra/mariabackup/ds_local.cc because the code is in the branch where fil_space_t::full_crc32(flags) does not hold. OK to push to 10.4 with that revision. I tested the patch on 10.5.

            People

              thiru Thirunarayanan Balathandayuthapani
              thiru Thirunarayanan Balathandayuthapani
              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.