fix aligned memcpy()-like functions usage

I found that memcpy_aligned was used incorrectly at redo log and decided to put
assertions in aligned functions. And found even more incorrect cases.

Given the amount discovered of bugs, I left assertions to prevent future bugs.

my_assume_aligned(): instead of MY_ASSUME_ALIGNED macro
This commit is contained in:
Eugene Kosov 2020-01-21 22:22:48 +08:00
commit 700e010309
11 changed files with 38 additions and 32 deletions

View file

@ -298,8 +298,7 @@ log_reserve_and_write_fast(
*start_lsn = log_sys.lsn;
memcpy_aligned<OS_FILE_LOG_BLOCK_SIZE>(log_sys.buf + log_sys.buf_free,
str, len);
memcpy(log_sys.buf + log_sys.buf_free, str, len);
log_block_set_data_len(
reinterpret_cast<byte*>(ut_align_down(

View file

@ -398,8 +398,7 @@ page_rec_is_infimum(const rec_t* rec);
inline trx_id_t page_get_max_trx_id(const page_t *page)
{
static_assert((PAGE_HEADER + PAGE_MAX_TRX_ID) % 8 == 0, "alignment");
const byte *p= static_cast<const byte*>
(MY_ASSUME_ALIGNED(page + PAGE_HEADER + PAGE_MAX_TRX_ID, 8));
const auto *p= my_assume_aligned<8>(page + PAGE_HEADER + PAGE_MAX_TRX_ID);
return mach_read_from_8(p);
}