diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-08 06:28:29 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-08 09:44:08 +0200 |
commit | 5d596064d676ae691d55cae653b1c461ab012e46 (patch) | |
tree | 7bcce75844a128ed401bf1a6c36ec7ad9ded05d9 /storage/innobase | |
parent | 52246dff2c76b0ba79993276c5853aae51ecb9b7 (diff) | |
download | mariadb-git-5d596064d676ae691d55cae653b1c461ab012e46.tar.gz |
Cleanup: Define FIL_PAGE_TYPE constants as constexpr
Diffstat (limited to 'storage/innobase')
-rw-r--r-- | storage/innobase/handler/i_s.cc | 8 | ||||
-rw-r--r-- | storage/innobase/include/fil0fil.h | 73 | ||||
-rw-r--r-- | storage/innobase/row/row0import.cc | 12 |
3 files changed, 51 insertions, 42 deletions
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc index 0b7e117e04b..9c809488a13 100644 --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -4164,9 +4164,10 @@ i_s_innodb_set_page_type( /*=====================*/ buf_page_info_t*page_info, /*!< in/out: structure to fill with scanned info */ - ulint page_type, /*!< in: page type */ const byte* frame) /*!< in: buffer frame */ { + uint16_t page_type = fil_page_get_type(frame); + if (fil_page_type_is_index(page_type)) { const page_t* page = (const page_t*) frame; @@ -4245,7 +4246,6 @@ i_s_innodb_buffer_page_get_info( BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_FILE_PAGE */ if (buf_page_in_file(bpage)) { const byte* frame; - ulint page_type; page_info->space_id = bpage->id.space(); @@ -4296,9 +4296,7 @@ i_s_innodb_buffer_page_get_info( frame = bpage->zip.data; } - page_type = fil_page_get_type(frame); - - i_s_innodb_set_page_type(page_info, page_type, frame); + i_s_innodb_set_page_type(page_info, frame); } else { page_info->page_type = I_S_PAGE_TYPE_UNKNOWN; } diff --git a/storage/innobase/include/fil0fil.h b/storage/innobase/include/fil0fil.h index c5ae91b0ae1..fa1fcaaf935 100644 --- a/storage/innobase/include/fil0fil.h +++ b/storage/innobase/include/fil0fil.h @@ -773,50 +773,63 @@ not using full_crc32 */ /** File page types (values of FIL_PAGE_TYPE) @{ */ /** page_compressed, encrypted=YES (not used for full_crc32) */ -#define FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED 37401 +constexpr uint16_t FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED= 37401; /** page_compressed (not used for full_crc32) */ -#define FIL_PAGE_PAGE_COMPRESSED 34354 /*!< page compressed page */ -#define FIL_PAGE_INDEX 17855 /*!< B-tree node */ -#define FIL_PAGE_RTREE 17854 /*!< R-tree node (SPATIAL INDEX) */ -#define FIL_PAGE_UNDO_LOG 2 /*!< Undo log page */ -#define FIL_PAGE_INODE 3 /*!< Index node */ -#define FIL_PAGE_IBUF_FREE_LIST 4 /*!< Insert buffer free list */ -/* File page types introduced in MySQL/InnoDB 5.1.7 */ -#define FIL_PAGE_TYPE_ALLOCATED 0 /*!< Freshly allocated page */ -#define FIL_PAGE_IBUF_BITMAP 5 /*!< Insert buffer bitmap */ -#define FIL_PAGE_TYPE_SYS 6 /*!< System page */ -#define FIL_PAGE_TYPE_TRX_SYS 7 /*!< Transaction system data */ -#define FIL_PAGE_TYPE_FSP_HDR 8 /*!< File space header */ -#define FIL_PAGE_TYPE_XDES 9 /*!< Extent descriptor page */ -#define FIL_PAGE_TYPE_BLOB 10 /*!< Uncompressed BLOB page */ -#define FIL_PAGE_TYPE_ZBLOB 11 /*!< First compressed BLOB page */ -#define FIL_PAGE_TYPE_ZBLOB2 12 /*!< Subsequent compressed BLOB page */ -#define FIL_PAGE_TYPE_UNKNOWN 13 /*!< In old tablespaces, garbage - in FIL_PAGE_TYPE is replaced with this - value when flushing pages. */ +constexpr uint16_t FIL_PAGE_PAGE_COMPRESSED= 34354; +/** B-tree index page */ +constexpr uint16_t FIL_PAGE_INDEX= 17855; +/** R-tree index page (SPATIAL INDEX) */ +constexpr uint16_t FIL_PAGE_RTREE= 17854; +/** Undo log page */ +constexpr uint16_t FIL_PAGE_UNDO_LOG= 2; +/** Index node (of file-in-file metadata) */ +constexpr uint16_t FIL_PAGE_INODE= 3; +/** Insert buffer free list */ +constexpr uint16_t FIL_PAGE_IBUF_FREE_LIST= 4; +/** Freshly allocated page */ +constexpr uint16_t FIL_PAGE_TYPE_ALLOCATED= 0; +/** Change buffer bitmap (pages n*innodb_page_size+1) */ +constexpr uint16_t FIL_PAGE_IBUF_BITMAP= 5; +/** System page */ +constexpr uint16_t FIL_PAGE_TYPE_SYS= 6; +/** Transaction system data */ +constexpr uint16_t FIL_PAGE_TYPE_TRX_SYS= 7; +/** Tablespace header (page 0) */ +constexpr uint16_t FIL_PAGE_TYPE_FSP_HDR= 8; +/** Extent descriptor page (pages n*innodb_page_size, except 0) */ +constexpr uint16_t FIL_PAGE_TYPE_XDES= 9; +/** Uncompressed BLOB page */ +constexpr uint16_t FIL_PAGE_TYPE_BLOB= 10; +/** First ROW_FORMAT=COMPRESSED BLOB page */ +constexpr uint16_t FIL_PAGE_TYPE_ZBLOB= 11; +/** Subsequent ROW_FORMAT=COMPRESSED BLOB page */ +constexpr uint16_t FIL_PAGE_TYPE_ZBLOB2= 12; +/** In old tablespaces, garbage in FIL_PAGE_TYPE is replaced with this +value when flushing pages. */ +constexpr uint16_t FIL_PAGE_TYPE_UNKNOWN= 13; /* File page types introduced in MySQL 5.7, not supported in MariaDB */ -//#define FIL_PAGE_COMPRESSED 14 -//#define FIL_PAGE_ENCRYPTED 15 -//#define FIL_PAGE_COMPRESSED_AND_ENCRYPTED 16 -//#define FIL_PAGE_ENCRYPTED_RTREE 17 +//constexpr uint16_t FIL_PAGE_COMPRESSED = 14; +//constexpr uint16_t FIL_PAGE_ENCRYPTED = 15; +//constexpr uint16_t FIL_PAGE_COMPRESSED_AND_ENCRYPTED = 16; +//constexpr FIL_PAGE_ENCRYPTED_RTREE = 17; /** Clustered index root page after instant ADD COLUMN */ -#define FIL_PAGE_TYPE_INSTANT 18 +constexpr uint16_t FIL_PAGE_TYPE_INSTANT= 18; /** Used by i_s.cc to index into the text description. Note: FIL_PAGE_TYPE_INSTANT maps to the same as FIL_PAGE_INDEX. */ -#define FIL_PAGE_TYPE_LAST FIL_PAGE_TYPE_UNKNOWN - /*!< Last page type */ -/** Set in FIL_PAGE_TYPE if for full_crc32 pages in page_compressed format. +constexpr uint16_t FIL_PAGE_TYPE_LAST= FIL_PAGE_TYPE_UNKNOWN; + +/** Set in FIL_PAGE_TYPE for full_crc32 pages in page_compressed format. If the flag is set, then the following holds for the remaining bits of FIL_PAGE_TYPE: Bits 0..7 will contain the compressed page size in bytes. Bits 8..14 are reserved and must be 0. */ -#define FIL_PAGE_COMPRESS_FCRC32_MARKER 15 +constexpr uint16_t FIL_PAGE_COMPRESS_FCRC32_MARKER= 15; /* @} */ /** @return whether the page type is B-tree or R-tree index */ -inline bool fil_page_type_is_index(ulint page_type) +inline bool fil_page_type_is_index(uint16_t page_type) { switch (page_type) { case FIL_PAGE_TYPE_INSTANT: diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 104f142b807..d1b2359f777 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -824,9 +824,8 @@ private: @param block block read from file @param page_type type of the page @retval DB_SUCCESS or error code */ - dberr_t update_page( - buf_block_t* block, - ulint& page_type) UNIV_NOTHROW; + dberr_t update_page(buf_block_t* block, uint16_t& page_type) + UNIV_NOTHROW; /** Update the space, index id, trx id. @param block block to convert @@ -1932,9 +1931,8 @@ PageConverter::update_header( @retval DB_SUCCESS or error code */ inline dberr_t -PageConverter::update_page( - buf_block_t* block, - ulint& page_type) UNIV_NOTHROW +PageConverter::update_page(buf_block_t* block, uint16_t& page_type) + UNIV_NOTHROW { dberr_t err = DB_SUCCESS; @@ -2015,7 +2013,7 @@ dberr_t PageConverter::operator()(buf_block_t* block) UNIV_NOTHROW RW_NO_LATCH, NULL, BUF_EVICT_IF_IN_POOL, __FILE__, __LINE__, NULL, NULL); - ulint page_type; + uint16_t page_type; if (dberr_t err = update_page(block, page_type)) { return err; |