diff options
Diffstat (limited to 'storage/innobase/include/fsp0fsp.h')
-rw-r--r-- | storage/innobase/include/fsp0fsp.h | 47 |
1 files changed, 18 insertions, 29 deletions
diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index b73fc2b54eb..26261554f9b 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -590,14 +590,11 @@ fseg_print( /** Convert FSP_SPACE_FLAGS from the buggy MariaDB 10.1.0..10.1.20 format. @param[in] flags the contents of FSP_SPACE_FLAGS @return the flags corrected from the buggy MariaDB 10.1 format -@retval ULINT_UNDEFINED if the flags are not in the buggy 10.1 format */ +@retval UINT32_MAX if the flags are not in the buggy 10.1 format */ MY_ATTRIBUTE((warn_unused_result, const)) -UNIV_INLINE -ulint -fsp_flags_convert_from_101(ulint flags) +inline uint32_t fsp_flags_convert_from_101(uint32_t flags) { - DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", - return(ULINT_UNDEFINED);); + DBUG_EXECUTE_IF("fsp_flags_is_valid_failure", return UINT32_MAX;); if (flags == 0 || fil_space_t::full_crc32(flags)) { return(flags); } @@ -606,7 +603,7 @@ fsp_flags_convert_from_101(ulint flags) /* The most significant FSP_SPACE_FLAGS bit that was ever set by MariaDB 10.1.0 to 10.1.20 was bit 17 (misplaced DATA_DIR flag). The flags must be less than 1<<18 in order to be valid. */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } if ((flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS)) @@ -615,7 +612,7 @@ fsp_flags_convert_from_101(ulint flags) ROW_FORMAT=DYNAMIC or ROW_FORMAT=COMPRESSED) flag is set, then the "post Antelope" (ROW_FORMAT!=REDUNDANT) flag must also be set. */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } /* Bits 6..10 denote compression in MariaDB 10.1.0 to 10.1.20. @@ -644,19 +641,19 @@ fsp_flags_convert_from_101(ulint flags) invalid (COMPRESSION_LEVEL=3 but COMPRESSION=0) +0b00000: innodb_page_size=16k (looks like COMPRESSION=0) ??? Could actually be compressed; see PAGE_SSIZE below */ - const ulint level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101( + const uint32_t level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL_MARIADB101( flags); if (FSP_FLAGS_GET_PAGE_COMPRESSION_MARIADB101(flags) != (level != 0) || level > 9) { /* The compression flags are not in the buggy MariaDB 10.1 format. */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } if (!(~flags & FSP_FLAGS_MASK_ATOMIC_WRITES_MARIADB101)) { /* The ATOMIC_WRITES flags cannot be 0b11. (The bits 11..12 should actually never be 0b11, because in MySQL they would be SHARED|TEMPORARY.) */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } /* Bits 13..16 are the wrong position for PAGE_SSIZE, and they @@ -671,23 +668,23 @@ fsp_flags_convert_from_101(ulint flags) will be properly rejected by older MariaDB 10.1.x because they would read as PAGE_SSIZE>=8 which is not valid. */ - const ulint ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags); + const uint32_t ssize = FSP_FLAGS_GET_PAGE_SSIZE_MARIADB101(flags); if (ssize == 1 || ssize == 2 || ssize == 5 || ssize & 8) { /* the page_size is not between 4k and 64k; 16k should be encoded as 0, not 5 */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } - const ulint zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags); + const uint32_t zssize = FSP_FLAGS_GET_ZIP_SSIZE(flags); if (zssize == 0) { /* not ROW_FORMAT=COMPRESSED */ } else if (zssize > (ssize ? ssize : 5)) { /* invalid KEY_BLOCK_SIZE */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } else if (~flags & (FSP_FLAGS_MASK_POST_ANTELOPE | FSP_FLAGS_MASK_ATOMIC_BLOBS)) { /* both these flags should be set for ROW_FORMAT=COMPRESSED */ - return(ULINT_UNDEFINED); + return UINT32_MAX; } flags = ((flags & 0x3f) | ssize << FSP_FLAGS_POS_PAGE_SSIZE @@ -702,19 +699,11 @@ fsp_flags_convert_from_101(ulint flags) @param[in] actual flags read from FSP_SPACE_FLAGS @return whether the flags match */ MY_ATTRIBUTE((warn_unused_result)) -UNIV_INLINE -bool -fsp_flags_match(ulint expected, ulint actual) +inline bool fsp_flags_match(uint32_t expected, uint32_t actual) { - expected &= ~FSP_FLAGS_MEM_MASK; - ut_ad(fil_space_t::is_valid_flags(expected, false)); - - if (actual == expected) { - return(true); - } - - actual = fsp_flags_convert_from_101(actual); - return(actual == expected); + expected&= ~FSP_FLAGS_MEM_MASK; + ut_ad(fil_space_t::is_valid_flags(expected, false)); + return actual == expected || fsp_flags_convert_from_101(actual) == expected; } /** Determine if FSP_SPACE_FLAGS are from an incompatible MySQL format. @@ -722,7 +711,7 @@ fsp_flags_match(ulint expected, ulint actual) @return MySQL flags shifted. @retval 0, if not a MySQL incompatible format. */ MY_ATTRIBUTE((warn_unused_result, const)) -inline ulint fsp_flags_is_incompatible_mysql(ulint flags) +inline uint32_t fsp_flags_is_incompatible_mysql(uint32_t flags) { /* MySQL-8.0 SDI flag (bit 14), |