Commit b3009059 authored by Marko Mäkelä's avatar Marko Mäkelä

Minor cleanup

parent 14be8143
......@@ -858,7 +858,7 @@ buf_dblwr_check_block(
but just happens to have wrongly set FIL_PAGE_TYPE,
such pages should never be modified to without also
adjusting the page type during page allocation or
buf_flush_init_for_writing() or fil_page_reset_type(). */
buf_flush_init_for_writing() or fil_block_reset_type(). */
break;
case FIL_PAGE_TYPE_FSP_HDR:
case FIL_PAGE_IBUF_BITMAP:
......
......@@ -5564,27 +5564,6 @@ fil_page_set_type(
mach_write_to_2(page + FIL_PAGE_TYPE, type);
}
/** Reset the page type.
Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] page_id page number
@param[in,out] page page with invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
void
fil_page_reset_type(
const page_id_t page_id,
byte* page,
ulint type,
mtr_t* mtr)
{
ib::info()
<< "Resetting invalid page " << page_id << " type "
<< fil_page_get_type(page) << " to " << type << ".";
mlog_write_ulint(page + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr);
}
/****************************************************************//**
Closes the tablespace memory cache. */
void
......@@ -6311,25 +6290,3 @@ fil_space_set_punch_hole(
{
node->space->punch_hole = val;
}
/** Check (and if needed, reset) the page type.
Data files created before MySQL 5.1 may contain
garbage in the FIL_PAGE_TYPE field.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] page_id page number
@param[in,out] page page with possibly invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
void
fil_block_check_type(
const buf_block_t& block,
ulint type,
mtr_t* mtr)
{
ulint page_type = fil_page_get_type(block.frame);
if (page_type != type) {
fil_page_reset_type(block.page.id, block.frame, type, mtr);
}
}
......@@ -1062,6 +1062,22 @@ fsp_get_pages_to_extend_ibd(
return(size_increase);
}
/** Reset the page type.
Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] block block with invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
ATTRIBUTE_COLD
void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr)
{
ib::info()
<< "Resetting invalid page " << block.page.id << " type "
<< fil_page_get_type(block.frame) << " to " << type << ".";
mlog_write_ulint(block.frame + FIL_PAGE_TYPE, type, MLOG_2BYTES, mtr);
}
/** Put new extents to the free list if there are free extents above the free
limit. If an extent happens to contain an extent descriptor page, the extent
is put to the FSP_FREE_FRAG list with the page marked as used.
......
......@@ -223,8 +223,7 @@ class page_id_t {
@param[in] space tablespace id
@param[in] page_no page number */
page_id_t(ulint space, ulint page_no)
: m_space(static_cast<uint32_t>(space)),
m_page_no(static_cast<uint32_t>(page_no))
: m_space(uint32_t(space)), m_page_no(uint32(page_no))
{
ut_ad(space <= 0xFFFFFFFFU);
ut_ad(page_no <= 0xFFFFFFFFU);
......@@ -238,30 +237,21 @@ class page_id_t {
/** Retrieve the tablespace id.
@return tablespace id */
inline uint32_t space() const
{
return(m_space);
}
uint32_t space() const { return m_space; }
/** Retrieve the page number.
@return page number */
inline uint32_t page_no() const
{
return(m_page_no);
}
uint32_t page_no() const { return m_page_no; }
/** Retrieve the fold value.
@return fold value */
inline ulint fold() const
{
return (m_space << 20) + m_space + m_page_no;
}
ulint fold() const { return (m_space << 20) + m_space + m_page_no; }
/** Reset the page number only.
@param[in] page_no page number */
inline void set_page_no(ulint page_no)
{
m_page_no = static_cast<uint32_t>(page_no);
m_page_no = uint32_t(page_no);
ut_ad(page_no <= 0xFFFFFFFFU);
}
......
......@@ -1315,45 +1315,6 @@ fil_page_set_type(
/*==============*/
byte* page, /*!< in/out: file page */
ulint type); /*!< in: type */
/** Reset the page type.
Data files created before MySQL 5.1 may contain garbage in FIL_PAGE_TYPE.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] page_id page number
@param[in,out] page page with invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
void
fil_page_reset_type(
const page_id_t page_id,
byte* page,
ulint type,
mtr_t* mtr);
/** Get the file page type.
@param[in] page file page
@return page type */
inline
uint16_t
fil_page_get_type(const byte* page)
{
return(mach_read_from_2(page + FIL_PAGE_TYPE));
}
/** Check (and if needed, reset) the page type.
Data files created before MySQL 5.1 may contain
garbage in the FIL_PAGE_TYPE field.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] page_id page number
@param[in,out] page page with possibly invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
void
fil_block_check_type(
const buf_block_t& block,
ulint type,
mtr_t* mtr);
#ifdef UNIV_DEBUG
/** Increase redo skipped of a tablespace.
......
......@@ -640,6 +640,44 @@ fseg_free_step_not_header_func(
fseg_free_step_not_header_func(header, mtr)
#endif /* BTR_CUR_HASH_ADAPT */
/** Reset the page type.
Data files created before MySQL 5.1.48 may contain garbage in FIL_PAGE_TYPE.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] block block with invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
ATTRIBUTE_COLD
void fil_block_reset_type(const buf_block_t& block, ulint type, mtr_t* mtr);
/** Get the file page type.
@param[in] page file page
@return page type */
inline uint16_t fil_page_get_type(const byte* page)
{
return mach_read_from_2(page + FIL_PAGE_TYPE);
}
/** Check (and if needed, reset) the page type.
Data files created before MySQL 5.1.48 may contain
garbage in the FIL_PAGE_TYPE field.
In MySQL 3.23.53, only undo log pages and index pages were tagged.
Any other pages were written with uninitialized bytes in FIL_PAGE_TYPE.
@param[in] page_id page number
@param[in,out] page page with possibly invalid FIL_PAGE_TYPE
@param[in] type expected page type
@param[in,out] mtr mini-transaction */
inline void
fil_block_check_type(
const buf_block_t& block,
ulint type,
mtr_t* mtr)
{
if (UNIV_UNLIKELY(type != fil_page_get_type(block.frame))) {
fil_block_reset_type(block, type, mtr);
}
}
/** Checks if a page address is an extent descriptor page address.
@param[in] page_id page id
@param[in] page_size page size
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment