diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-07 12:25:00 +0300 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2020-05-07 12:25:00 +0300 |
commit | ba573c4736f908a6525acddb7573cc7d818eaa25 (patch) | |
tree | fe8ba66b9a53e743839dd126ae26dca2339a56d7 | |
parent | 0781c91d288e528477e4ab446f91522a8802e5ec (diff) | |
download | mariadb-git-ba573c4736f908a6525acddb7573cc7d818eaa25.tar.gz |
MDEV-21133 follow-up: More my_assume_aligned hints
fsp0pagecompress.h: Remove.
Invoke fil_page_get_type() and FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL
directly.
log_block_get_flush_bit(), log_block_set_flush_bit():
Access the byte directly.
dict_sys_read_row_id(): Remove (unused function).
-rw-r--r-- | extra/innochecksum.cc | 3 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.cc | 7 | ||||
-rw-r--r-- | storage/innobase/fil/fil0pagecompress.cc | 19 | ||||
-rw-r--r-- | storage/innobase/include/btr0btr.h | 7 | ||||
-rw-r--r-- | storage/innobase/include/buf0buf.h | 21 | ||||
-rw-r--r-- | storage/innobase/include/dict0boot.h | 10 | ||||
-rw-r--r-- | storage/innobase/include/dict0boot.ic | 14 | ||||
-rw-r--r-- | storage/innobase/include/fil0pagecompress.h | 1 | ||||
-rw-r--r-- | storage/innobase/include/fsp0fsp.h | 7 | ||||
-rw-r--r-- | storage/innobase/include/fsp0pagecompress.h | 53 | ||||
-rw-r--r-- | storage/innobase/include/fsp0pagecompress.ic | 63 | ||||
-rw-r--r-- | storage/innobase/include/log0log.ic | 68 | ||||
-rw-r--r-- | storage/innobase/include/page0page.ic | 9 | ||||
-rw-r--r-- | storage/innobase/row/row0import.cc | 5 |
14 files changed, 82 insertions, 205 deletions
diff --git a/extra/innochecksum.cc b/extra/innochecksum.cc index a2c1ebf7acc..81deba4c390 100644 --- a/extra/innochecksum.cc +++ b/extra/innochecksum.cc @@ -1,6 +1,6 @@ /* Copyright (c) 2005, 2016, Oracle and/or its affiliates. All rights reserved. - Copyright (c) 2014, 2019, MariaDB Corporation. + Copyright (c) 2014, 2020, 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 @@ -49,7 +49,6 @@ The parts not included are excluded by #ifndef UNIV_INNOCHECKSUM. */ #include "page0zip.h" /* page_zip_*() */ #include "trx0undo.h" /* TRX_* */ #include "ut0crc32.h" /* ut_crc32_init() */ -#include "fsp0pagecompress.h" /* fil_get_compression_alg_name */ #include "fil0crypt.h" /* fil_space_verify_crypt_checksum */ #include <string.h> diff --git a/storage/innobase/buf/buf0buf.cc b/storage/innobase/buf/buf0buf.cc index c9a85084c21..bc092ef5381 100644 --- a/storage/innobase/buf/buf0buf.cc +++ b/storage/innobase/buf/buf0buf.cc @@ -61,7 +61,6 @@ Created 11/5/1995 Heikki Tuuri #include "srv0mon.h" #include "log0crypt.h" #include "fil0pagecompress.h" -#include "fsp0pagecompress.h" #endif /* !UNIV_INNOCHECKSUM */ #include "page0zip.h" #include "sync0sync.h" @@ -470,12 +469,14 @@ decrypt_failed: ut_d(fil_page_type_validate(space, dst_frame)); if ((space->full_crc32() && page_compressed) - || fil_page_is_compressed_encrypted(dst_frame)) { + || fil_page_get_type(dst_frame) + == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { goto decompress_with_slot; } slot->release(); - } else if (fil_page_is_compressed_encrypted(dst_frame)) { + } else if (fil_page_get_type(dst_frame) + == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED) { goto decompress; } diff --git a/storage/innobase/fil/fil0pagecompress.cc b/storage/innobase/fil/fil0pagecompress.cc index bea8877215a..b800f12d6c7 100644 --- a/storage/innobase/fil/fil0pagecompress.cc +++ b/storage/innobase/fil/fil0pagecompress.cc @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (C) 2013, 2019, MariaDB Corporation. +Copyright (C) 2013, 2020, 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 @@ -201,7 +201,7 @@ static ulint fil_page_compress_for_full_crc32( ulint block_size, bool encrypted) { - ulint comp_level = fsp_flags_get_page_compression_level(flags); + ulint comp_level = FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags); if (comp_level == 0) { comp_level = page_zip_level; @@ -284,7 +284,8 @@ static ulint fil_page_compress_for_non_full_crc32( ulint block_size, bool encrypted) { - int comp_level = int(fsp_flags_get_page_compression_level(flags)); + uint comp_level = static_cast<uint>( + FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags)); ulint header_len = FIL_PAGE_DATA + FIL_PAGE_COMP_METADATA_LEN; /* Cache to avoid change during function execution */ ulint comp_algo = innodb_compression_algorithm; @@ -296,7 +297,7 @@ static ulint fil_page_compress_for_non_full_crc32( /* If no compression level was provided to this table, use system default level */ if (comp_level == 0) { - comp_level = int(page_zip_level); + comp_level = page_zip_level; } ulint write_size = fil_page_compress_low( @@ -334,8 +335,14 @@ static ulint fil_page_compress_for_non_full_crc32( #ifdef UNIV_DEBUG /* Verify */ - ut_ad(fil_page_is_compressed(out_buf) - || fil_page_is_compressed_encrypted(out_buf)); + switch (fil_page_get_type(out_buf)) { + case FIL_PAGE_PAGE_COMPRESSED: + case FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED: + break; + default: + ut_ad("wrong page type" == 0); + break; + } ut_ad(mach_read_from_4(out_buf + FIL_PAGE_SPACE_OR_CHKSUM) == BUF_NO_CHECKSUM_MAGIC); diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 81db9432ac6..b02c65f3a31 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -282,7 +282,8 @@ btr_page_get_index_id( @retval 0 for leaf pages */ inline uint16_t btr_page_get_level(const page_t *page) { - uint16_t level = mach_read_from_2(page + PAGE_HEADER + PAGE_LEVEL); + uint16_t level= mach_read_from_2(my_assume_aligned<2> + (PAGE_HEADER + PAGE_LEVEL + page)); ut_ad(level <= BTR_MAX_NODE_LEVEL); return level; } MY_ATTRIBUTE((warn_unused_result)) @@ -292,7 +293,7 @@ inline uint16_t btr_page_get_level(const page_t *page) @return previous page number */ inline uint32_t btr_page_get_next(const page_t* page) { - return mach_read_from_4(page + FIL_PAGE_NEXT); + return mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_NEXT)); } /** Read FIL_PAGE_PREV. @@ -300,7 +301,7 @@ inline uint32_t btr_page_get_next(const page_t* page) @return previous page number */ inline uint32_t btr_page_get_prev(const page_t* page) { - return mach_read_from_4(page + FIL_PAGE_PREV); + return mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_PREV)); } /**************************************************************//** diff --git a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h index 6a21e59d7c3..f0a894e700f 100644 --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -34,6 +34,7 @@ Created 11/5/1995 Heikki Tuuri #include "mtr0types.h" #include "buf0types.h" #include "span.h" +#include "assume_aligned.h" #ifndef UNIV_INNOCHECKSUM #include "hash0hash.h" #include "ut0byte.h" @@ -572,10 +573,11 @@ stored in 26th position. @return key version of the page. */ inline uint32_t buf_page_get_key_version(const byte* read_buf, ulint fsp_flags) { - return fil_space_t::full_crc32(fsp_flags) - ? mach_read_from_4(read_buf + FIL_PAGE_FCRC32_KEY_VERSION) - : mach_read_from_4(read_buf - + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION); + static_assert(FIL_PAGE_FCRC32_KEY_VERSION == 0, "compatibility"); + return fil_space_t::full_crc32(fsp_flags) + ? mach_read_from_4(my_assume_aligned<4>(read_buf)) + : mach_read_from_4(my_assume_aligned<2> + (read_buf + FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION)); } /** Read the compression info from the page. In full crc32 format, @@ -586,10 +588,11 @@ stored in page type. @return true if page is compressed. */ inline bool buf_page_is_compressed(const byte* read_buf, ulint fsp_flags) { - ulint page_type = mach_read_from_2(read_buf + FIL_PAGE_TYPE); - return fil_space_t::full_crc32(fsp_flags) - ? !!(page_type & 1U << FIL_PAGE_COMPRESS_FCRC32_MARKER) - : page_type == FIL_PAGE_PAGE_COMPRESSED; + uint16_t page_type= mach_read_from_2(my_assume_aligned<2> + (read_buf + FIL_PAGE_TYPE)); + return fil_space_t::full_crc32(fsp_flags) + ? !!(page_type & 1U << FIL_PAGE_COMPRESS_FCRC32_MARKER) + : page_type == FIL_PAGE_PAGE_COMPRESSED; } /** Get the compressed or uncompressed size of a full_crc32 page. @@ -599,7 +602,7 @@ inline bool buf_page_is_compressed(const byte* read_buf, ulint fsp_flags) @return the payload size in the file page */ inline uint buf_page_full_crc32_size(const byte* buf, bool* comp, bool* cr) { - uint t = mach_read_from_2(buf + FIL_PAGE_TYPE); + uint t = mach_read_from_2(my_assume_aligned<2>(buf + FIL_PAGE_TYPE)); uint page_size = uint(srv_page_size); if (!(t & 1U << FIL_PAGE_COMPRESS_FCRC32_MARKER)) { diff --git a/storage/innobase/include/dict0boot.h b/storage/innobase/include/dict0boot.h index 3144303c1a1..0f96df8fd9f 100644 --- a/storage/innobase/include/dict0boot.h +++ b/storage/innobase/include/dict0boot.h @@ -1,7 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. -Copyright (c) 2018, 2019, MariaDB Corporation. +Copyright (c) 2018, 2020, 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 @@ -60,14 +60,6 @@ row_id_t dict_sys_get_new_row_id(void); /*=========================*/ /**********************************************************************//** -Reads a row id from a record or other 6-byte stored form. -@return row id */ -UNIV_INLINE -row_id_t -dict_sys_read_row_id( -/*=================*/ - const byte* field); /*!< in: record field */ -/**********************************************************************//** Writes a row id to a record or other 6-byte stored form. */ UNIV_INLINE void diff --git a/storage/innobase/include/dict0boot.ic b/storage/innobase/include/dict0boot.ic index 7b0a2fd0b86..d920bddecee 100644 --- a/storage/innobase/include/dict0boot.ic +++ b/storage/innobase/include/dict0boot.ic @@ -1,6 +1,7 @@ /***************************************************************************** Copyright (c) 1996, 2013, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 2020, 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 @@ -50,19 +51,6 @@ dict_sys_get_new_row_id(void) } /**********************************************************************//** -Reads a row id from a record or other 6-byte stored form. -@return row id */ -UNIV_INLINE -row_id_t -dict_sys_read_row_id( -/*=================*/ - const byte* field) /*!< in: record field */ -{ - compile_time_assert(DATA_ROW_ID_LEN == 6); - return(mach_read_from_6(field)); -} - -/**********************************************************************//** Writes a row id to a record or other 6-byte stored form. */ UNIV_INLINE void diff --git a/storage/innobase/include/fil0pagecompress.h b/storage/innobase/include/fil0pagecompress.h index 9baf3289380..c6ba24faaad 100644 --- a/storage/innobase/include/fil0pagecompress.h +++ b/storage/innobase/include/fil0pagecompress.h @@ -20,7 +20,6 @@ this program; if not, write to the Free Software Foundation, Inc., #define fil0pagecompress_h #include "fsp0fsp.h" -#include "fsp0pagecompress.h" /******************************************************************//** @file include/fil0pagecompress.h diff --git a/storage/innobase/include/fsp0fsp.h b/storage/innobase/include/fsp0fsp.h index 983b7e11c95..073854b31bd 100644 --- a/storage/innobase/include/fsp0fsp.h +++ b/storage/innobase/include/fsp0fsp.h @@ -307,11 +307,10 @@ inline bool xdes_is_free(const xdes_t *descr, ulint offset) @param[in] page first page of a tablespace @param[in] field the header field @return the contents of the header field */ -inline -ulint -fsp_header_get_field(const page_t* page, ulint field) +inline uint32_t fsp_header_get_field(const page_t* page, ulint field) { - return(mach_read_from_4(FSP_HEADER_OFFSET + field + page)); + return mach_read_from_4(FSP_HEADER_OFFSET + field + + my_assume_aligned<UNIV_ZIP_SIZE_MIN>(page)); } /** Read the flags from the tablespace header page. diff --git a/storage/innobase/include/fsp0pagecompress.h b/storage/innobase/include/fsp0pagecompress.h deleted file mode 100644 index 27423858435..00000000000 --- a/storage/innobase/include/fsp0pagecompress.h +++ /dev/null @@ -1,53 +0,0 @@ -/***************************************************************************** - -Copyright (C) 2013, 2017, MariaDB Corporation. All Rights Reserved. - -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 -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/******************************************************************//** -@file include/fsp0pagecompress.h -Helper functions for extracting/storing page compression and -atomic writes information to file space. - -Created 11/12/2013 Jan Lindström jan.lindstrom@skysql.com -***********************************************************************/ - -#ifndef fsp0pagecompress_h -#define fsp0pagecompress_h - -/**********************************************************************//** -Reads the page compression level from the first page of a tablespace. -@return page compression level, or 0 if uncompressed */ -UNIV_INTERN -ulint -fsp_header_get_compression_level( -/*=============================*/ - const page_t* page); /*!< in: first page of a tablespace */ - -/********************************************************************//** -Extract the page compression level from tablespace flags. -A tablespace has only one physical page compression level -whether that page is compressed or not. -@return page compression level of the file-per-table tablespace, -or zero if the table is not compressed. */ -UNIV_INLINE -ulint -fsp_flags_get_page_compression_level( -/*=================================*/ - ulint flags); /*!< in: tablespace flags */ - -#include "fsp0pagecompress.ic" - -#endif diff --git a/storage/innobase/include/fsp0pagecompress.ic b/storage/innobase/include/fsp0pagecompress.ic deleted file mode 100644 index 590a609c309..00000000000 --- a/storage/innobase/include/fsp0pagecompress.ic +++ /dev/null @@ -1,63 +0,0 @@ -/***************************************************************************** - -Copyright (C) 2013, 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 -Foundation; version 2 of the License. - -This program is distributed in the hope that it will be useful, but WITHOUT -ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS -FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License along with -this program; if not, write to the Free Software Foundation, Inc., -51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA - -*****************************************************************************/ - -/******************************************************************//** -@file include/fsp0pagecompress.ic -Implementation for helper functions for extracting/storing page -compression and atomic writes information to file space. - -Created 11/12/2013 Jan Lindström jan.lindstrom@mariadb.com - -***********************************************************************/ - -/********************************************************************//** -Determine the tablespace is page compression level from dict_table_t::flags. -@return page compression level or 0 if not compressed*/ -UNIV_INLINE -ulint -fsp_flags_get_page_compression_level( -/*=================================*/ - ulint flags) /*!< in: tablespace flags */ -{ - return(FSP_FLAGS_GET_PAGE_COMPRESSION_LEVEL(flags)); -} - - -/*******************************************************************//** -Find out wheather the page is page compressed -@return true if page is page compressed, false if not */ -UNIV_INLINE -bool -fil_page_is_compressed( -/*===================*/ - const byte* buf) /*!< in: page */ -{ - return(mach_read_from_2(buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED); -} - -/*******************************************************************//** -Find out wheather the page is page compressed -@return true if page is page compressed, false if not */ -UNIV_INLINE -bool -fil_page_is_compressed_encrypted( -/*=============================*/ - const byte* buf) /*!< in: page */ -{ - return(mach_read_from_2(buf+FIL_PAGE_TYPE) == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED); -} diff --git a/storage/innobase/include/log0log.ic b/storage/innobase/include/log0log.ic index 46dfb0dd028..4fdc2b0258e 100644 --- a/storage/innobase/include/log0log.ic +++ b/storage/innobase/include/log0log.ic @@ -25,7 +25,7 @@ Created 12/9/1995 Heikki Tuuri *******************************************************/ #include "mach0data.h" -#include "srv0mon.h" +#include "assume_aligned.h" #include "ut0crc32.h" extern ulong srv_log_buffer_size; @@ -39,13 +39,10 @@ log_block_get_flush_bit( /*====================*/ const byte* log_block) /*!< in: log block */ { - if (LOG_BLOCK_FLUSH_BIT_MASK - & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)) { + static_assert(LOG_BLOCK_HDR_NO == 0, "compatibility"); + static_assert(LOG_BLOCK_FLUSH_BIT_MASK == 0x80000000, "compatibility"); - return(TRUE); - } - - return(FALSE); + return *log_block & 0x80; } /************************************************************//** @@ -57,17 +54,13 @@ log_block_set_flush_bit( byte* log_block, /*!< in/out: log block */ ibool val) /*!< in: value to set */ { - ulint field; - - field = mach_read_from_4(log_block + LOG_BLOCK_HDR_NO); - - if (val) { - field = field | LOG_BLOCK_FLUSH_BIT_MASK; - } else { - field = field & ~LOG_BLOCK_FLUSH_BIT_MASK; - } + static_assert(LOG_BLOCK_HDR_NO == 0, "compatibility"); + static_assert(LOG_BLOCK_FLUSH_BIT_MASK == 0x80000000, "compatibility"); - mach_write_to_4(log_block + LOG_BLOCK_HDR_NO, field); + if (val) + *log_block|= 0x80; + else + *log_block&= 0x7f; } /************************************************************//** @@ -79,8 +72,9 @@ log_block_get_hdr_no( /*=================*/ const byte* log_block) /*!< in: log block */ { - return(~LOG_BLOCK_FLUSH_BIT_MASK - & mach_read_from_4(log_block + LOG_BLOCK_HDR_NO)); + static_assert(LOG_BLOCK_HDR_NO == 0, "compatibility"); + return mach_read_from_4(my_assume_aligned<4>(log_block)) & + ~LOG_BLOCK_FLUSH_BIT_MASK; } /************************************************************//** @@ -94,10 +88,11 @@ log_block_set_hdr_no( ulint n) /*!< in: log block number: must be > 0 and < LOG_BLOCK_FLUSH_BIT_MASK */ { - ut_ad(n > 0); - ut_ad(n < LOG_BLOCK_FLUSH_BIT_MASK); + static_assert(LOG_BLOCK_HDR_NO == 0, "compatibility"); + ut_ad(n > 0); + ut_ad(n < LOG_BLOCK_FLUSH_BIT_MASK); - mach_write_to_4(log_block + LOG_BLOCK_HDR_NO, n); + mach_write_to_4(my_assume_aligned<4>(log_block), n); } /************************************************************//** @@ -109,7 +104,8 @@ log_block_get_data_len( /*===================*/ const byte* log_block) /*!< in: log block */ { - return(mach_read_from_2(log_block + LOG_BLOCK_HDR_DATA_LEN)); + return mach_read_from_2(my_assume_aligned<2> + (log_block + LOG_BLOCK_HDR_DATA_LEN)); } /************************************************************//** @@ -121,7 +117,8 @@ log_block_set_data_len( byte* log_block, /*!< in/out: log block */ ulint len) /*!< in: data length */ { - mach_write_to_2(log_block + LOG_BLOCK_HDR_DATA_LEN, len); + mach_write_to_2(my_assume_aligned<2>(log_block + LOG_BLOCK_HDR_DATA_LEN), + len); } /************************************************************//** @@ -134,7 +131,8 @@ log_block_get_first_rec_group( /*==========================*/ const byte* log_block) /*!< in: log block */ { - return(mach_read_from_2(log_block + LOG_BLOCK_FIRST_REC_GROUP)); + return mach_read_from_2(my_assume_aligned<2> + (log_block + LOG_BLOCK_FIRST_REC_GROUP)); } /************************************************************//** @@ -146,7 +144,8 @@ log_block_set_first_rec_group( byte* log_block, /*!< in/out: log block */ ulint offset) /*!< in: offset, 0 if none */ { - mach_write_to_2(log_block + LOG_BLOCK_FIRST_REC_GROUP, offset); + mach_write_to_2(my_assume_aligned<2> + (log_block + LOG_BLOCK_FIRST_REC_GROUP), offset); } /************************************************************//** @@ -158,7 +157,8 @@ log_block_get_checkpoint_no( /*========================*/ const byte* log_block) /*!< in: log block */ { - return(mach_read_from_4(log_block + LOG_BLOCK_CHECKPOINT_NO)); + return mach_read_from_4(my_assume_aligned<4> + (log_block + LOG_BLOCK_CHECKPOINT_NO)); } /************************************************************//** @@ -170,7 +170,8 @@ log_block_set_checkpoint_no( byte* log_block, /*!< in/out: log block */ ib_uint64_t no) /*!< in: checkpoint no */ { - mach_write_to_4(log_block + LOG_BLOCK_CHECKPOINT_NO, (ulint) no); + mach_write_to_4(my_assume_aligned<4>(log_block + LOG_BLOCK_CHECKPOINT_NO), + static_cast<uint32_t>(no)); } /************************************************************//** @@ -204,8 +205,9 @@ log_block_get_checksum( /*===================*/ const byte* log_block) /*!< in: log block */ { - return(mach_read_from_4(log_block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_CHECKSUM)); + return mach_read_from_4(my_assume_aligned<4> + (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM + + log_block)); } /************************************************************//** @@ -217,9 +219,9 @@ log_block_set_checksum( byte* log_block, /*!< in/out: log block */ ulint checksum) /*!< in: checksum */ { - mach_write_to_4(log_block + OS_FILE_LOG_BLOCK_SIZE - - LOG_BLOCK_CHECKSUM, - checksum); + mach_write_to_4(my_assume_aligned<4> + (OS_FILE_LOG_BLOCK_SIZE - LOG_BLOCK_CHECKSUM + + log_block), checksum); } /************************************************************//** diff --git a/storage/innobase/include/page0page.ic b/storage/innobase/include/page0page.ic index 668287c121a..7ec5d2eec3d 100644 --- a/storage/innobase/include/page0page.ic +++ b/storage/innobase/include/page0page.ic @@ -305,8 +305,8 @@ page_get_page_no( /*=============*/ const page_t* page) /*!< in: page */ { - ut_ad(page == page_align((page_t*) page)); - return(mach_read_from_4(page + FIL_PAGE_OFFSET)); + ut_ad(page == page_align((page_t*) page)); + return mach_read_from_4(my_assume_aligned<4>(page + FIL_PAGE_OFFSET)); } #ifndef UNIV_INNOCHECKSUM @@ -319,8 +319,9 @@ page_get_space_id( /*==============*/ const page_t* page) /*!< in: page */ { - ut_ad(page == page_align((page_t*) page)); - return(mach_read_from_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); + ut_ad(page == page_align((page_t*) page)); + return mach_read_from_4(my_assume_aligned<2> + (page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID)); } #endif /* !UNIV_INNOCHECKSUM */ diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc index 39a3855ac44..880b64616e8 100644 --- a/storage/innobase/row/row0import.cc +++ b/storage/innobase/row/row0import.cc @@ -3500,14 +3500,15 @@ page_corrupted: src + FIL_PAGE_SPACE_ID); } + const uint16_t type = fil_page_get_type(src); const bool page_compressed = (full_crc32 && fil_space_t::is_compressed( callback.get_space_flags()) && buf_page_is_compressed( src, callback.get_space_flags())) - || (fil_page_is_compressed_encrypted(src) - || fil_page_is_compressed(src)); + || type == FIL_PAGE_PAGE_COMPRESSED_ENCRYPTED + || type == FIL_PAGE_PAGE_COMPRESSED; if (page_compressed && block->page.zip.data) { goto page_corrupted; |