[MDEV-23254] Replace FSP_FLAGS_HAS_PAGE_COMPRESSION with fil_space_t::is_compressed Created: 2020-07-22  Updated: 2020-07-22  Resolved: 2020-07-22

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.4.3
Fix Version/s: 10.4.14, 10.5.5

Type: Bug Priority: Major
Reporter: Thirunarayanan Balathandayuthapani Assignee: Thirunarayanan Balathandayuthapani
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Blocks
blocks MDEV-23252 Assertion failure 'req_type.is_dblwr_... Closed
Problem/Incident
is caused by MDEV-12026 Support encrypted SPATIAL INDEX Closed

 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.



 Comments   
Comment by Thirunarayanan Balathandayuthapani [ 2020-07-22 ]

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;
        }

Comment by Marko Mäkelä [ 2020-07-22 ]

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.

Generated at Thu Feb 08 09:21:01 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.