diff options
author | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-08 09:41:06 +0200 |
---|---|---|
committer | Marko Mäkelä <marko.makela@mariadb.com> | 2019-11-08 09:41:06 +0200 |
commit | 78d0d2cdc56634cd6212b5c6320a938d4dff42cc (patch) | |
tree | 6579b79faaddd834ffca15f6a42f55c6cb416fef /storage/innobase/fsp | |
parent | 8a5eb4141b2ca9b8cc4e6510f4eba8f5ff9eb7dd (diff) | |
download | mariadb-git-78d0d2cdc56634cd6212b5c6320a938d4dff42cc.tar.gz |
Cleanup: Remove mach_read_ulint()
The function mach_read_ulint() is a wrapper for the lower-level
functions mach_read_from_1(), mach_read_from_2(), mach_read_from_8().
Invoke those functions directly, for better readability of the code.
mtr_t::read_ulint(), mtr_read_ulint(): Remove. Yes, we will lose the
ability to assert that the read is covered by the mini-transaction.
We would still check that on writes, and any writes that
wrongly bypass mini-transaction logging would likely be caught by
stress testing with Mariabackup.
Diffstat (limited to 'storage/innobase/fsp')
-rw-r--r-- | storage/innobase/fsp/fsp0fsp.cc | 48 |
1 files changed, 14 insertions, 34 deletions
diff --git a/storage/innobase/fsp/fsp0fsp.cc b/storage/innobase/fsp/fsp0fsp.cc index dec1f0cecca..3b324b6c437 100644 --- a/storage/innobase/fsp/fsp0fsp.cc +++ b/storage/innobase/fsp/fsp0fsp.cc @@ -1386,8 +1386,7 @@ static void fsp_free_page(fil_space_t* space, page_no_t offset, xdes_set_bit(descr, XDES_FREE_BIT, bit, TRUE, mtr); xdes_set_bit(descr, XDES_CLEAN_BIT, bit, TRUE, mtr); - frag_n_used = mtr_read_ulint(header + FSP_FRAG_N_USED, MLOG_4BYTES, - mtr); + frag_n_used = mach_read_from_4(header + FSP_FRAG_N_USED); if (state == XDES_FULL_FRAG) { /* The fragment was full: move it to another list */ flst_remove(header + FSP_FULL_FRAG, descr + XDES_FLST_NODE, @@ -2610,8 +2609,7 @@ try_again: n_free_list_ext = flst_get_len(space_header + FSP_FREE); ut_ad(space->free_len == n_free_list_ext); - free_limit = mtr_read_ulint(space_header + FSP_FREE_LIMIT, - MLOG_4BYTES, mtr); + free_limit = mach_read_from_4(space_header + FSP_FREE_LIMIT); ut_ad(space->free_limit == free_limit); /* Below we play safe when counting free extents above the free limit: @@ -2693,9 +2691,7 @@ fseg_mark_page_used( ut_ad(!((page_offset(seg_inode) - FSEG_ARR_OFFSET) % FSEG_INODE_SIZE)); ut_ad(mach_read_from_4(seg_inode + FSEG_MAGIC_N) == FSEG_MAGIC_N_VALUE); - - ut_ad(mtr_read_ulint(seg_inode + FSEG_ID, MLOG_4BYTES, mtr) - == mtr_read_ulint(descr + XDES_ID, MLOG_4BYTES, mtr)); + ut_ad(!memcmp(seg_inode + FSEG_ID, descr + XDES_ID, 4)); if (xdes_is_free(descr, mtr)) { /* We move the extent from the free list to the @@ -2712,8 +2708,7 @@ fseg_mark_page_used( /* We mark the page as used */ xdes_set_bit(descr, XDES_FREE_BIT, page % FSP_EXTENT_SIZE, FALSE, mtr); - not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED, - MLOG_4BYTES, mtr); + not_full_n_used = mach_read_from_4(seg_inode + FSEG_NOT_FULL_N_USED); not_full_n_used++; mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED, not_full_n_used, MLOG_4BYTES, mtr); @@ -2825,8 +2820,7 @@ fseg_free_page_low( << FORCE_RECOVERY_MSG; } - not_full_n_used = mtr_read_ulint(seg_inode + FSEG_NOT_FULL_N_USED, - MLOG_4BYTES, mtr); + not_full_n_used = mach_read_from_4(seg_inode + FSEG_NOT_FULL_N_USED); if (xdes_is_full(descr, mtr)) { /* The fragment is full: move it to another list */ flst_remove(seg_inode + FSEG_FULL, @@ -2991,9 +2985,8 @@ fseg_free_extent( flst_remove(seg_inode + FSEG_NOT_FULL, descr + XDES_FLST_NODE, mtr); - not_full_n_used = mtr_read_ulint( - seg_inode + FSEG_NOT_FULL_N_USED, MLOG_4BYTES, mtr); - + not_full_n_used = mach_read_from_4(FSEG_NOT_FULL_N_USED + + seg_inode); descr_n_used = xdes_get_n_used(descr, mtr); ut_a(not_full_n_used >= descr_n_used); mlog_write_ulint(seg_inode + FSEG_NOT_FULL_N_USED, @@ -3234,9 +3227,7 @@ fseg_print_low( reserved = fseg_n_reserved_pages_low(inode, &used, mtr); seg_id = mach_read_from_8(inode + FSEG_ID); - - n_used = mtr_read_ulint(inode + FSEG_NOT_FULL_N_USED, - MLOG_4BYTES, mtr); + n_used = mach_read_from_4(inode + FSEG_NOT_FULL_N_USED); n_frag = fseg_get_n_frag_pages(inode, mtr); n_free = flst_get_len(inode + FSEG_FREE); n_not_full = flst_get_len(inode + FSEG_NOT_FULL); @@ -3275,23 +3266,12 @@ fseg_print( #endif /* UNIV_BTR_PRINT */ #ifdef UNIV_DEBUG -/** Print the file segment header to the given output stream. -@param[in] out the output stream into which the object is printed. -@retval the output stream into which the object was printed. */ -std::ostream& -fseg_header::to_stream(std::ostream& out) const +std::ostream &fseg_header::to_stream(std::ostream &out) const { - const ulint space = mtr_read_ulint(m_header + FSEG_HDR_SPACE, - MLOG_4BYTES, m_mtr); - const ulint page_no = mtr_read_ulint(m_header + FSEG_HDR_PAGE_NO, - MLOG_4BYTES, m_mtr); - - const ulint offset = mtr_read_ulint(m_header + FSEG_HDR_OFFSET, - MLOG_2BYTES, m_mtr); - - out << "[fseg_header_t: space=" << space << ", page=" - << page_no << ", offset=" << offset << "]"; - - return(out); + out << "[fseg_header_t: space=" + << mach_read_from_4(m_header + FSEG_HDR_SPACE) + << ", page=" << mach_read_from_4(m_header + FSEG_HDR_PAGE_NO) + << ", offset=" << mach_read_from_2(m_header + FSEG_HDR_OFFSET) << "]"; + return out; } #endif /* UNIV_DEBUG */ |