diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-13 21:58:35 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2018-12-13 21:58:35 +0200 |
commit | f6e16bdc62d80a1b26a955aafb1b60fafa912beb (patch) | |
tree | bb2d6126379b0e0518d0064b584b8677d3df8582 /storage/innobase/include | |
parent | 839cf16bb2de078d5000bcb2f9b3151f1ebda708 (diff) | |
parent | e3dda3d95ee4c09c2ed45ce886ecd25d1fc1ae92 (diff) | |
download | mariadb-git-f6e16bdc62d80a1b26a955aafb1b60fafa912beb.tar.gz |
Merge 10.2 into 10.3
Diffstat (limited to 'storage/innobase/include')
-rw-r--r-- | storage/innobase/include/buf0buf.h | 4 | ||||
-rw-r--r-- | storage/innobase/include/buf0checksum.h | 30 | ||||
-rw-r--r-- | storage/innobase/include/dict0dict.ic | 17 | ||||
-rw-r--r-- | storage/innobase/include/page0page.h | 11 | ||||
-rw-r--r-- | storage/innobase/include/page0zip.h | 11 | ||||
-rw-r--r-- | storage/innobase/include/ut0crc32.h | 6 |
6 files changed, 37 insertions, 42 deletions
diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 8ca9ddd28fe..86a433d36e3 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -716,14 +716,12 @@ buf_block_unfix( @param[in] read_buf database page @param[in] checksum_field1 new checksum field @param[in] checksum_field2 old checksum field -@param[in] use_legacy_big_endian use legacy big endian algorithm @return true if the page is in crc32 checksum format. */ bool buf_page_is_checksum_valid_crc32( const byte* read_buf, ulint checksum_field1, - ulint checksum_field2, - bool use_legacy_big_endian) + ulint checksum_field2) MY_ATTRIBUTE((nonnull(1), warn_unused_result)); /** Checks if the page is in innodb checksum format. diff --git a/storage/innobase/include/buf0checksum.h b/storage/innobase/include/buf0checksum.h index 98c6ff16a6a..06eb37906d2 100644 --- a/storage/innobase/include/buf0checksum.h +++ b/storage/innobase/include/buf0checksum.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2017, MariaDB Corporation. +Copyright (c) 2017, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -29,19 +29,26 @@ Created Aug 11, 2011 Vasil Dimov #include "buf0types.h" +#ifdef INNODB_BUG_ENDIAN_CRC32 /** Calculate the CRC32 checksum of a page. The value is stored to the page when it is written to a file and also checked for a match when reading from -the file. When reading we allow both normal CRC32 and CRC-legacy-big-endian -variants. Note that we must be careful to calculate the same value on 32-bit -and 64-bit architectures. +the file. Note that we must be careful to calculate the same value on all +architectures. +@param[in] page buffer page (srv_page_size bytes) +@param[in] bug_endian whether to use big endian byteorder +when converting byte strings to integers, for bug-compatibility with +big-endian architecture running MySQL 5.6, MariaDB 10.0 or MariaDB 10.1 +@return CRC-32C */ +uint32_t buf_calc_page_crc32(const byte* page, bool bug_endian = false); +#else +/** Calculate the CRC32 checksum of a page. The value is stored to the page +when it is written to a file and also checked for a match when reading from +the file. Note that we must be careful to calculate the same value on all +architectures. @param[in] page buffer page (srv_page_size bytes) -@param[in] use_legacy_big_endian if true then use big endian -byteorder when converting byte strings to integers -@return checksum */ -uint32_t -buf_calc_page_crc32( - const byte* page, - bool use_legacy_big_endian = false); +@return CRC-32C */ +uint32_t buf_calc_page_crc32(const byte* page); +#endif /** Calculate a checksum which is stored to the page when it is written to a file. Note that we must be careful to calculate the same value on @@ -69,6 +76,5 @@ const char* buf_checksum_algorithm_name(srv_checksum_algorithm_t algo); extern ulong srv_checksum_algorithm; -extern bool legacy_big_endian_checksum; #endif /* buf0checksum_h */ diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index 03b842e041d..78e16774a09 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -685,31 +685,30 @@ dict_tf_set( bool page_compressed, ulint page_compression_level) { + *flags = use_data_dir ? 1 << DICT_TF_POS_DATA_DIR : 0; + switch (format) { case REC_FORMAT_REDUNDANT: - *flags = 0; ut_ad(zip_ssize == 0); - break; + /* no other options are allowed */ + ut_ad(!page_compressed); + return; case REC_FORMAT_COMPACT: - *flags = DICT_TF_COMPACT; + *flags |= DICT_TF_COMPACT; ut_ad(zip_ssize == 0); break; case REC_FORMAT_COMPRESSED: - *flags = DICT_TF_COMPACT + *flags |= DICT_TF_COMPACT | (1 << DICT_TF_POS_ATOMIC_BLOBS) | (zip_ssize << DICT_TF_POS_ZIP_SSIZE); break; case REC_FORMAT_DYNAMIC: - *flags = DICT_TF_COMPACT + *flags |= DICT_TF_COMPACT | (1 << DICT_TF_POS_ATOMIC_BLOBS); ut_ad(zip_ssize == 0); break; } - if (use_data_dir) { - *flags |= (1 << DICT_TF_POS_DATA_DIR); - } - if (page_compressed) { *flags |= (1 << DICT_TF_POS_ATOMIC_BLOBS) | (1 << DICT_TF_POS_PAGE_COMPRESSION) diff --git a/storage/innobase/include/page0page.h b/storage/innobase/include/page0page.h index 0ff63f8047f..58115b767d2 100644 --- a/storage/innobase/include/page0page.h +++ b/storage/innobase/include/page0page.h @@ -1351,17 +1351,6 @@ const rec_t* page_find_rec_max_not_deleted( const page_t* page); -/** Issue a warning when the checksum that is stored in the page is valid, -but different than the global setting innodb_checksum_algorithm. -@param[in] current_algo current checksum algorithm -@param[in] page_checksum page valid checksum -@param[in] page_id page identifier */ -void -page_warn_strict_checksum( - srv_checksum_algorithm_t curr_algo, - srv_checksum_algorithm_t page_checksum, - const page_id_t page_id); - #ifdef UNIV_MATERIALIZE #undef UNIV_INLINE #define UNIV_INLINE UNIV_INLINE_ORIGINAL diff --git a/storage/innobase/include/page0zip.h b/storage/innobase/include/page0zip.h index a2910a73634..bb9bb049c22 100644 --- a/storage/innobase/include/page0zip.h +++ b/storage/innobase/include/page0zip.h @@ -513,16 +513,17 @@ page_zip_parse_compress( @param[in] data compressed page @param[in] size size of compressed page @param[in] algo algorithm to use -@param[in] use_legacy_big_endian only used if algo is -SRV_CHECKSUM_ALGORITHM_CRC32 or SRV_CHECKSUM_ALGORITHM_STRICT_CRC32 - if true -then use big endian byteorder when converting byte strings to integers. @return page checksum */ uint32_t page_zip_calc_checksum( const void* data, ulint size, - srv_checksum_algorithm_t algo, - bool use_legacy_big_endian = false); + srv_checksum_algorithm_t algo +#ifdef INNODB_BUG_ENDIAN_CRC32 + /** for crc32, use the big-endian bug-compatible crc32 variant */ + , bool use_legacy_big_endian = false +#endif +); /**********************************************************************//** Verify a compressed page's checksum. diff --git a/storage/innobase/include/ut0crc32.h b/storage/innobase/include/ut0crc32.h index 32ad066f85a..b8fc4168dfd 100644 --- a/storage/innobase/include/ut0crc32.h +++ b/storage/innobase/include/ut0crc32.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2016, MariaDB Corporation. +Copyright (c) 2016, 2018, MariaDB Corporation. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -47,9 +47,11 @@ typedef uint32_t (*ut_crc32_func_t)(const byte* ptr, ulint len); /** Pointer to CRC32 calculation function. */ extern ut_crc32_func_t ut_crc32; -/** CRC32 calculation function, which uses big-endian byte order +#ifdef INNODB_BUG_ENDIAN_CRC32 +/** Pointer to CRC32 calculation function, which uses big-endian byte order when converting byte strings to integers internally. */ extern uint32_t ut_crc32_legacy_big_endian(const byte* buf, ulint len); +#endif /* INNODB_BUG_ENDIAN_CRC32 */ /** Text description of CRC32 implementation */ extern const char* ut_crc32_implementation; |