mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 21:12:26 +01:00
MDEV-17491 micro optimize page_id_t #892
This commit is contained in:
commit
a6ffeeeaa9
32 changed files with 196 additions and 316 deletions
|
@ -1149,7 +1149,7 @@ btr_free_root_invalidate(
|
|||
static MY_ATTRIBUTE((warn_unused_result))
|
||||
buf_block_t*
|
||||
btr_free_root_check(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
index_id_t index_id,
|
||||
mtr_t* mtr)
|
||||
|
@ -1421,7 +1421,7 @@ top_loop:
|
|||
@param[in,out] mtr mini-transaction */
|
||||
void
|
||||
btr_free_if_exists(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
index_id_t index_id,
|
||||
mtr_t* mtr)
|
||||
|
@ -1445,7 +1445,7 @@ btr_free_if_exists(
|
|||
@param[in] page_size page size */
|
||||
void
|
||||
btr_free(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
mtr_t mtr;
|
||||
|
|
|
@ -231,7 +231,7 @@ btr_rec_free_externally_stored_fields(
|
|||
btr_latch_leaves_t
|
||||
btr_cur_latch_leaves(
|
||||
buf_block_t* block,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint latch_mode,
|
||||
btr_cur_t* cursor,
|
||||
|
@ -1684,7 +1684,7 @@ need_opposite_intention:
|
|||
|
||||
lock_intention = BTR_INTENTION_BOTH;
|
||||
|
||||
page_id.reset(space, dict_index_get_page(index));
|
||||
page_id = page_id_t(space, dict_index_get_page(index));
|
||||
up_match = 0;
|
||||
low_match = 0;
|
||||
height = ULINT_UNDEFINED;
|
||||
|
@ -1900,7 +1900,7 @@ need_opposite_intention:
|
|||
ulint idx = n_blocks
|
||||
- (leftmost_from_level - 1);
|
||||
|
||||
page_id.reset(
|
||||
page_id = page_id_t(
|
||||
space,
|
||||
tree_blocks[idx]->page.id.page_no());
|
||||
|
||||
|
@ -1935,7 +1935,7 @@ need_opposite_intention:
|
|||
}
|
||||
|
||||
/* Go to the child node */
|
||||
page_id.reset(
|
||||
page_id = page_id_t(
|
||||
space,
|
||||
btr_node_ptr_get_child_page_no(node_ptr, offsets));
|
||||
|
||||
|
|
|
@ -1304,7 +1304,7 @@ cleanup:
|
|||
/** Drop possible adaptive hash index entries when a page is evicted
|
||||
from the buffer pool or freed in a file, or the index is being dropped.
|
||||
@param[in] page_id page id */
|
||||
void btr_search_drop_page_hash_when_freed(const page_id_t& page_id)
|
||||
void btr_search_drop_page_hash_when_freed(const page_id_t page_id)
|
||||
{
|
||||
buf_block_t* block;
|
||||
mtr_t mtr;
|
||||
|
|
|
@ -2280,7 +2280,8 @@ buf_page_realloc(
|
|||
memset(block->frame + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, 0xff, 4);
|
||||
UNIV_MEM_INVALID(block->frame, UNIV_PAGE_SIZE);
|
||||
buf_block_set_state(block, BUF_BLOCK_REMOVE_HASH);
|
||||
block->page.id.reset(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
|
||||
block->page.id
|
||||
= page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
|
||||
|
||||
/* Relocate buf_pool->flush_list. */
|
||||
if (block->page.oldest_modification) {
|
||||
|
@ -3505,7 +3506,7 @@ hash_lock and reacquire it.
|
|||
static
|
||||
buf_page_t*
|
||||
buf_pool_watch_set(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
rw_lock_t** hash_lock)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
|
@ -3583,7 +3584,7 @@ page_found:
|
|||
buf_block_t::mutex or buf_pool->zip_mutex or both. */
|
||||
|
||||
bpage->state = BUF_BLOCK_ZIP_PAGE;
|
||||
bpage->id.copy_from(page_id);
|
||||
bpage->id = page_id;
|
||||
bpage->buf_fix_count = 1;
|
||||
|
||||
ut_d(bpage->in_page_hash = TRUE);
|
||||
|
@ -3647,9 +3648,7 @@ buf_pool_watch_remove(
|
|||
/** Stop watching if the page has been read in.
|
||||
buf_pool_watch_set(same_page_id) must have returned NULL before.
|
||||
@param[in] page_id page id */
|
||||
void
|
||||
buf_pool_watch_unset(
|
||||
const page_id_t& page_id)
|
||||
void buf_pool_watch_unset(const page_id_t page_id)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
buf_pool_t* buf_pool = buf_pool_get(page_id);
|
||||
|
@ -3681,12 +3680,10 @@ buf_pool_watch_unset(
|
|||
This may only be called after buf_pool_watch_set(same_page_id)
|
||||
has returned NULL and before invoking buf_pool_watch_unset(same_page_id).
|
||||
@param[in] page_id page id
|
||||
@return FALSE if the given page was not read in, TRUE if it was */
|
||||
ibool
|
||||
buf_pool_watch_occurred(
|
||||
const page_id_t& page_id)
|
||||
@return false if the given page was not read in, true if it was */
|
||||
bool buf_pool_watch_occurred(const page_id_t page_id)
|
||||
{
|
||||
ibool ret;
|
||||
bool ret;
|
||||
buf_page_t* bpage;
|
||||
buf_pool_t* buf_pool = buf_pool_get(page_id);
|
||||
rw_lock_t* hash_lock = buf_page_hash_lock_get(buf_pool, page_id);
|
||||
|
@ -3756,9 +3753,7 @@ debug version to check that it is not accessed any more unless
|
|||
reallocated.
|
||||
@param[in] page_id page id
|
||||
@return control block if found in page hash table, otherwise NULL */
|
||||
buf_page_t*
|
||||
buf_page_set_file_page_was_freed(
|
||||
const page_id_t& page_id)
|
||||
buf_page_t* buf_page_set_file_page_was_freed(const page_id_t page_id)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
buf_pool_t* buf_pool = buf_pool_get(page_id);
|
||||
|
@ -3786,9 +3781,7 @@ debug version to check that it is not accessed any more unless
|
|||
reallocated.
|
||||
@param[in] page_id page id
|
||||
@return control block if found in page hash table, otherwise NULL */
|
||||
buf_page_t*
|
||||
buf_page_reset_file_page_was_freed(
|
||||
const page_id_t& page_id)
|
||||
buf_page_t* buf_page_reset_file_page_was_freed(const page_id_t page_id)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
buf_pool_t* buf_pool = buf_pool_get(page_id);
|
||||
|
@ -3810,12 +3803,8 @@ buf_page_reset_file_page_was_freed(
|
|||
|
||||
/** Attempts to discard the uncompressed frame of a compressed page.
|
||||
The caller should not be holding any mutexes when this function is called.
|
||||
@param[in] page_id page id
|
||||
@return TRUE if successful, FALSE otherwise. */
|
||||
static
|
||||
void
|
||||
buf_block_try_discard_uncompressed(
|
||||
const page_id_t& page_id)
|
||||
@param[in] page_id page id */
|
||||
static void buf_block_try_discard_uncompressed(const page_id_t page_id)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
buf_pool_t* buf_pool = buf_pool_get(page_id);
|
||||
|
@ -3849,7 +3838,7 @@ the same set of mutexes or latches.
|
|||
@return pointer to the block */
|
||||
buf_page_t*
|
||||
buf_page_get_zip(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
|
@ -4300,7 +4289,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
|
|||
@return pointer to the block or NULL */
|
||||
buf_block_t*
|
||||
buf_page_get_gen(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint rw_latch,
|
||||
buf_block_t* guess,
|
||||
|
@ -4375,7 +4364,7 @@ loop:
|
|||
it may have been freed by buf_relocate(). */
|
||||
|
||||
if (!buf_block_is_uncompressed(buf_pool, block)
|
||||
|| !page_id.equals_to(block->page.id)
|
||||
|| page_id != block->page.id
|
||||
|| buf_block_get_state(block) != BUF_BLOCK_FILE_PAGE) {
|
||||
|
||||
/* Our guess was bogus or things have changed
|
||||
|
@ -5206,7 +5195,7 @@ Suitable for using when holding the lock_sys_t::mutex.
|
|||
@return pointer to a page or NULL */
|
||||
buf_block_t*
|
||||
buf_page_try_get_func(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const char* file,
|
||||
unsigned line,
|
||||
mtr_t* mtr)
|
||||
|
@ -5235,7 +5224,7 @@ buf_page_try_get_func(
|
|||
|
||||
#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
|
||||
ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
|
||||
ut_a(page_id.equals_to(block->page.id));
|
||||
ut_a(page_id == block->page.id);
|
||||
#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
|
||||
|
||||
buf_block_buf_fix_inc(block, file, line);
|
||||
|
@ -5321,7 +5310,7 @@ static
|
|||
void
|
||||
buf_page_init(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
buf_block_t* block)
|
||||
{
|
||||
|
@ -5389,7 +5378,7 @@ buf_page_init(
|
|||
ut_ad(!block->page.in_page_hash);
|
||||
ut_d(block->page.in_page_hash = TRUE);
|
||||
|
||||
block->page.id.copy_from(page_id);
|
||||
block->page.id = page_id;
|
||||
block->page.size.copy_from(page_size);
|
||||
|
||||
HASH_INSERT(buf_page_t, hash, buf_pool->page_hash,
|
||||
|
@ -5419,7 +5408,7 @@ buf_page_t*
|
|||
buf_page_init_for_read(
|
||||
dberr_t* err,
|
||||
ulint mode,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
bool unzip)
|
||||
{
|
||||
|
@ -5588,7 +5577,7 @@ buf_page_init_for_read(
|
|||
buf_page_init_low(bpage);
|
||||
|
||||
bpage->state = BUF_BLOCK_ZIP_PAGE;
|
||||
bpage->id.copy_from(page_id);
|
||||
bpage->id = page_id;
|
||||
bpage->flush_observer = NULL;
|
||||
|
||||
ut_d(bpage->in_page_hash = FALSE);
|
||||
|
@ -5657,7 +5646,7 @@ FILE_PAGE (the other is buf_page_get_gen).
|
|||
@return pointer to the block, page bufferfixed */
|
||||
buf_block_t*
|
||||
buf_page_create(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
mtr_t* mtr)
|
||||
{
|
||||
|
@ -7364,7 +7353,7 @@ buf_pool_check_no_pending_io(void)
|
|||
std::ostream&
|
||||
operator<<(
|
||||
std::ostream& out,
|
||||
const page_id_t& page_id)
|
||||
const page_id_t page_id)
|
||||
{
|
||||
out << "[page id: space=" << page_id.m_space
|
||||
<< ", page number=" << page_id.m_page_no << "]";
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -1296,7 +1296,7 @@ buf_flush_page_try(
|
|||
static
|
||||
bool
|
||||
buf_flush_check_neighbor(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
buf_flush_t flush_type)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
|
@ -1346,7 +1346,7 @@ buf_flush_check_neighbor(
|
|||
static
|
||||
ulint
|
||||
buf_flush_try_neighbors(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
buf_flush_t flush_type,
|
||||
ulint n_flushed,
|
||||
ulint n_to_flush)
|
||||
|
|
|
@ -2161,7 +2161,8 @@ buf_LRU_block_free_hashed_page(
|
|||
buf_page_mutex_enter(block);
|
||||
|
||||
if (buf_pool->flush_rbt == NULL) {
|
||||
block->page.id.reset(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
|
||||
block->page.id
|
||||
= page_id_t(ULINT32_UNDEFINED, ULINT32_UNDEFINED);
|
||||
}
|
||||
|
||||
buf_block_set_state(block, BUF_BLOCK_MEMORY);
|
||||
|
|
|
@ -117,7 +117,7 @@ buf_read_page_low(
|
|||
bool sync,
|
||||
ulint type,
|
||||
ulint mode,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
bool unzip,
|
||||
bool ignore_missing_space = false)
|
||||
|
@ -239,7 +239,7 @@ pages, it may happen that the page at the given page number does not
|
|||
get read even if we return a positive value! */
|
||||
ulint
|
||||
buf_read_ahead_random(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ibool inside_ibuf)
|
||||
{
|
||||
|
@ -419,7 +419,7 @@ after decryption normal page checksum does not match.
|
|||
@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */
|
||||
dberr_t
|
||||
buf_read_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
ulint count;
|
||||
|
@ -457,7 +457,7 @@ released by the i/o-handler thread.
|
|||
@param[in] sync true if synchronous aio is desired */
|
||||
void
|
||||
buf_read_page_background(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
bool sync)
|
||||
{
|
||||
|
@ -529,7 +529,7 @@ which could result in a deadlock if the OS does not support asynchronous io.
|
|||
@return number of page read requests issued */
|
||||
ulint
|
||||
buf_read_ahead_linear(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ibool inside_ibuf)
|
||||
{
|
||||
|
|
|
@ -265,7 +265,7 @@ i/o on a tablespace which does not exist */
|
|||
UNIV_INLINE
|
||||
dberr_t
|
||||
fil_read(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint byte_offset,
|
||||
ulint len,
|
||||
|
@ -291,7 +291,7 @@ i/o on a tablespace which does not exist */
|
|||
UNIV_INLINE
|
||||
dberr_t
|
||||
fil_write(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint byte_offset,
|
||||
ulint len,
|
||||
|
@ -4988,7 +4988,7 @@ dberr_t
|
|||
fil_io(
|
||||
const IORequest& type,
|
||||
bool sync,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint byte_offset,
|
||||
ulint len,
|
||||
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
@ -1197,7 +1213,7 @@ fsp_fill_free_list(
|
|||
header, space, i, mtr, init_space, &desc_block);
|
||||
if (desc_block != NULL) {
|
||||
fil_block_check_type(
|
||||
desc_block, FIL_PAGE_TYPE_XDES, mtr);
|
||||
*desc_block, FIL_PAGE_TYPE_XDES, mtr);
|
||||
}
|
||||
xdes_init(descr, mtr);
|
||||
|
||||
|
@ -1256,7 +1272,7 @@ fsp_alloc_free_extent(
|
|||
header, space, hint, mtr, false, &desc_block);
|
||||
|
||||
if (desc_block != NULL) {
|
||||
fil_block_check_type(desc_block, FIL_PAGE_TYPE_XDES, mtr);
|
||||
fil_block_check_type(*desc_block, FIL_PAGE_TYPE_XDES, mtr);
|
||||
}
|
||||
|
||||
if (descr && (xdes_get_state(descr, mtr) == XDES_FREE)) {
|
||||
|
@ -1798,7 +1814,7 @@ fsp_alloc_seg_inode(
|
|||
|
||||
block = buf_page_get(page_id, page_size, RW_SX_LATCH, mtr);
|
||||
buf_block_dbg_add_level(block, SYNC_FSP_PAGE);
|
||||
fil_block_check_type(block, FIL_PAGE_INODE, mtr);
|
||||
fil_block_check_type(*block, FIL_PAGE_INODE, mtr);
|
||||
|
||||
page = buf_block_get_frame(block);
|
||||
|
||||
|
@ -2105,7 +2121,7 @@ fseg_create_general(
|
|||
? FIL_PAGE_TYPE_TRX_SYS
|
||||
: FIL_PAGE_TYPE_SYS;
|
||||
|
||||
fil_block_check_type(block, type, mtr);
|
||||
fil_block_check_type(*block, type, mtr);
|
||||
}
|
||||
|
||||
if (!has_done_reservation
|
||||
|
@ -2690,7 +2706,7 @@ fseg_alloc_free_page_general(
|
|||
const page_size_t page_size(space->flags);
|
||||
|
||||
inode = fseg_inode_get(seg_header, space_id, page_size, mtr, &iblock);
|
||||
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
|
||||
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
|
||||
|
||||
if (!has_done_reservation
|
||||
&& !fsp_reserve_free_extents(&n_reserved, space_id, 2,
|
||||
|
@ -3173,7 +3189,7 @@ fseg_free_page_func(
|
|||
|
||||
seg_inode = fseg_inode_get(seg_header, space_id, page_size, mtr,
|
||||
&iblock);
|
||||
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
|
||||
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
|
||||
|
||||
fseg_free_page_low(seg_inode, space, page, page_size, ahi, mtr);
|
||||
|
||||
|
@ -3353,7 +3369,7 @@ fseg_free_step_func(
|
|||
DBUG_RETURN(TRUE);
|
||||
}
|
||||
|
||||
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
|
||||
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
|
||||
descr = fseg_get_first_extent(inode, space, page_size, mtr);
|
||||
|
||||
if (descr != NULL) {
|
||||
|
@ -3421,7 +3437,7 @@ fseg_free_step_not_header_func(
|
|||
buf_block_t* iblock;
|
||||
|
||||
inode = fseg_inode_get(header, space_id, page_size, mtr, &iblock);
|
||||
fil_block_check_type(iblock, FIL_PAGE_INODE, mtr);
|
||||
fil_block_check_type(*iblock, FIL_PAGE_INODE, mtr);
|
||||
|
||||
descr = fseg_get_first_extent(inode, space, page_size, mtr);
|
||||
|
||||
|
|
|
@ -212,7 +212,7 @@ static ulint ibuf_counts[IBUF_COUNT_N_SPACES][IBUF_COUNT_N_PAGES];
|
|||
UNIV_INLINE
|
||||
void
|
||||
ibuf_count_check(
|
||||
const page_id_t& page_id)
|
||||
const page_id_t page_id)
|
||||
{
|
||||
if (page_id.space() < IBUF_COUNT_N_SPACES
|
||||
&& page_id.page_no() < IBUF_COUNT_N_PAGES) {
|
||||
|
@ -423,9 +423,7 @@ ibuf_tree_root_get(
|
|||
@param[in] page_id page id
|
||||
@return number of entries in the insert buffer currently buffered for
|
||||
this page */
|
||||
ulint
|
||||
ibuf_count_get(
|
||||
const page_id_t& page_id)
|
||||
ulint ibuf_count_get(const page_id_t page_id)
|
||||
{
|
||||
ibuf_count_check(page_id);
|
||||
|
||||
|
@ -438,7 +436,7 @@ ibuf_count_get(
|
|||
static
|
||||
void
|
||||
ibuf_count_set(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
ulint val)
|
||||
{
|
||||
ibuf_count_check(page_id);
|
||||
|
@ -674,7 +672,7 @@ UNIV_INLINE
|
|||
ulint
|
||||
ibuf_bitmap_page_get_bits_low(
|
||||
const page_t* page,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
#ifdef UNIV_DEBUG
|
||||
ulint latch_type,
|
||||
|
@ -725,7 +723,7 @@ static
|
|||
void
|
||||
ibuf_bitmap_page_set_bits(
|
||||
page_t* page,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint bit,
|
||||
ulint val,
|
||||
|
@ -778,7 +776,7 @@ ibuf_bitmap_page_set_bits(
|
|||
UNIV_INLINE
|
||||
const page_id_t
|
||||
ibuf_bitmap_page_no_calc(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
ulint bitmap_page_no;
|
||||
|
@ -802,7 +800,7 @@ is x-latched */
|
|||
static
|
||||
page_t*
|
||||
ibuf_bitmap_get_map_page_func(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
const char* file,
|
||||
unsigned line,
|
||||
|
@ -1105,7 +1103,7 @@ ibuf_update_free_bits_for_two_pages_low(
|
|||
UNIV_INLINE
|
||||
ibool
|
||||
ibuf_fixed_addr_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
return((page_id.space() == IBUF_SPACE_ID
|
||||
|
@ -1127,7 +1125,7 @@ in which case a new transaction is created.
|
|||
@return TRUE if level 2 or level 3 page */
|
||||
ibool
|
||||
ibuf_page_low(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
#ifdef UNIV_DEBUG
|
||||
ibool x_latch,
|
||||
|
@ -3360,7 +3358,7 @@ ibuf_insert_low(
|
|||
const dtuple_t* entry,
|
||||
ulint entry_size,
|
||||
dict_index_t* index,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
que_thr_t* thr)
|
||||
{
|
||||
|
@ -3700,7 +3698,7 @@ ibuf_insert(
|
|||
ibuf_op_t op,
|
||||
const dtuple_t* entry,
|
||||
dict_index_t* index,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
que_thr_t* thr)
|
||||
{
|
||||
|
@ -4436,7 +4434,7 @@ want to update a non-existent bitmap page */
|
|||
void
|
||||
ibuf_merge_or_delete_for_page(
|
||||
buf_block_t* block,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t* page_size,
|
||||
ibool update_ibuf_bitmap)
|
||||
{
|
||||
|
@ -4454,7 +4452,7 @@ ibuf_merge_or_delete_for_page(
|
|||
ulint mops[IBUF_OP_COUNT];
|
||||
ulint dops[IBUF_OP_COUNT];
|
||||
|
||||
ut_ad(block == NULL || page_id.equals_to(block->page.id));
|
||||
ut_ad(block == NULL || page_id == block->page.id);
|
||||
ut_ad(block == NULL || buf_block_get_io_fix(block) == BUF_IO_READ);
|
||||
|
||||
if (srv_force_recovery >= SRV_FORCE_NO_IBUF_MERGE
|
||||
|
|
|
@ -231,7 +231,7 @@ tree
|
|||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
btr_block_get_func(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint mode,
|
||||
const char* file,
|
||||
|
@ -272,7 +272,7 @@ UNIV_INLINE
|
|||
page_t*
|
||||
btr_page_get(
|
||||
/*=========*/
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint mode,
|
||||
dict_index_t* index,
|
||||
|
@ -371,7 +371,7 @@ btr_create(
|
|||
@param[in,out] mtr mini-transaction */
|
||||
void
|
||||
btr_free_if_exists(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
index_id_t index_id,
|
||||
mtr_t* mtr);
|
||||
|
@ -381,7 +381,7 @@ btr_free_if_exists(
|
|||
@param[in] page_size page size */
|
||||
void
|
||||
btr_free(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size);
|
||||
|
||||
/** Read the last used AUTO_INCREMENT value from PAGE_ROOT_AUTO_INC.
|
||||
|
|
|
@ -47,7 +47,7 @@ tree
|
|||
UNIV_INLINE
|
||||
buf_block_t*
|
||||
btr_block_get_func(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint mode,
|
||||
const char* file,
|
||||
|
@ -113,7 +113,7 @@ UNIV_INLINE
|
|||
page_t*
|
||||
btr_page_get(
|
||||
/*=========*/
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint mode,
|
||||
dict_index_t* index,
|
||||
|
|
|
@ -795,7 +795,7 @@ btr_rec_set_deleted_flag(
|
|||
btr_latch_leaves_t
|
||||
btr_cur_latch_leaves(
|
||||
buf_block_t* block,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint latch_mode,
|
||||
btr_cur_t* cursor,
|
||||
|
|
|
@ -133,7 +133,7 @@ btr_search_drop_page_hash_index(buf_block_t* block);
|
|||
/** Drop possible adaptive hash index entries when a page is evicted
|
||||
from the buffer pool or freed in a file, or the index is being dropped.
|
||||
@param[in] page_id page id */
|
||||
void btr_search_drop_page_hash_when_freed(const page_id_t& page_id);
|
||||
void btr_search_drop_page_hash_when_freed(const page_id_t page_id);
|
||||
|
||||
/** Updates the page hash index when a single record is inserted on a page.
|
||||
@param[in] cursor cursor which was positioned to the place to insert
|
||||
|
|
|
@ -223,96 +223,46 @@ public:
|
|||
@param[in] space tablespace id
|
||||
@param[in] page_no page number */
|
||||
page_id_t(ulint space, ulint page_no)
|
||||
:
|
||||
m_space(static_cast<ib_uint32_t>(space)),
|
||||
m_page_no(static_cast<ib_uint32_t>(page_no)),
|
||||
m_fold(ULINT_UNDEFINED)
|
||||
: m_space(uint32_t(space)), m_page_no(uint32(page_no))
|
||||
{
|
||||
ut_ad(space <= 0xFFFFFFFFU);
|
||||
ut_ad(page_no <= 0xFFFFFFFFU);
|
||||
}
|
||||
|
||||
bool operator==(const page_id_t& rhs) const
|
||||
{
|
||||
return m_space == rhs.m_space && m_page_no == rhs.m_page_no;
|
||||
}
|
||||
bool operator!=(const page_id_t& rhs) const { return !(*this == rhs); }
|
||||
|
||||
/** Retrieve the tablespace id.
|
||||
@return tablespace id */
|
||||
inline ib_uint32_t space() const
|
||||
{
|
||||
return(m_space);
|
||||
}
|
||||
uint32_t space() const { return m_space; }
|
||||
|
||||
/** Retrieve the page number.
|
||||
@return page number */
|
||||
inline ib_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
|
||||
{
|
||||
/* Initialize m_fold if it has not been initialized yet. */
|
||||
if (m_fold == ULINT_UNDEFINED) {
|
||||
m_fold = (m_space << 20) + m_space + m_page_no;
|
||||
ut_ad(m_fold != ULINT_UNDEFINED);
|
||||
}
|
||||
|
||||
return(m_fold);
|
||||
}
|
||||
|
||||
/** Copy the values from a given page_id_t object.
|
||||
@param[in] src page id object whose values to fetch */
|
||||
inline void copy_from(const page_id_t& src)
|
||||
{
|
||||
m_space = src.space();
|
||||
m_page_no = src.page_no();
|
||||
m_fold = src.fold();
|
||||
}
|
||||
|
||||
/** Reset the values from a (space, page_no).
|
||||
@param[in] space tablespace id
|
||||
@param[in] page_no page number */
|
||||
inline void reset(ulint space, ulint page_no)
|
||||
{
|
||||
m_space = static_cast<ib_uint32_t>(space);
|
||||
m_page_no = static_cast<ib_uint32_t>(page_no);
|
||||
m_fold = ULINT_UNDEFINED;
|
||||
|
||||
ut_ad(space <= 0xFFFFFFFFU);
|
||||
ut_ad(page_no <= 0xFFFFFFFFU);
|
||||
}
|
||||
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<ib_uint32_t>(page_no);
|
||||
m_fold = ULINT_UNDEFINED;
|
||||
m_page_no = uint32_t(page_no);
|
||||
|
||||
ut_ad(page_no <= 0xFFFFFFFFU);
|
||||
}
|
||||
|
||||
/** Check if a given page_id_t object is equal to the current one.
|
||||
@param[in] a page_id_t object to compare
|
||||
@return true if equal */
|
||||
inline bool equals_to(const page_id_t& a) const
|
||||
{
|
||||
return(a.space() == m_space && a.page_no() == m_page_no);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/** Tablespace id. */
|
||||
ib_uint32_t m_space;
|
||||
uint32_t m_space;
|
||||
|
||||
/** Page number. */
|
||||
ib_uint32_t m_page_no;
|
||||
|
||||
/** A fold value derived from m_space and m_page_no,
|
||||
used in hashing. */
|
||||
mutable ulint m_fold;
|
||||
|
||||
/* Disable implicit copying. */
|
||||
void operator=(const page_id_t&);
|
||||
uint32_t m_page_no;
|
||||
|
||||
/** Declare the overloaded global operator<< as a friend of this
|
||||
class. Refer to the global declaration for further details. Print
|
||||
|
@ -324,7 +274,7 @@ private:
|
|||
std::ostream&
|
||||
operator<<(
|
||||
std::ostream& out,
|
||||
const page_id_t& page_id);
|
||||
const page_id_t page_id);
|
||||
};
|
||||
|
||||
/** Print the given page_id_t object.
|
||||
|
@ -334,7 +284,7 @@ private:
|
|||
std::ostream&
|
||||
operator<<(
|
||||
std::ostream& out,
|
||||
const page_id_t& page_id);
|
||||
const page_id_t page_id);
|
||||
|
||||
#ifndef UNIV_INNOCHECKSUM
|
||||
/********************************************************************//**
|
||||
|
@ -517,7 +467,7 @@ Suitable for using when holding the lock_sys_t::mutex.
|
|||
@return pointer to a page or NULL */
|
||||
buf_block_t*
|
||||
buf_page_try_get_func(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const char* file,
|
||||
unsigned line,
|
||||
mtr_t* mtr);
|
||||
|
@ -543,7 +493,7 @@ the same set of mutexes or latches.
|
|||
@return pointer to the block */
|
||||
buf_page_t*
|
||||
buf_page_get_zip(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size);
|
||||
|
||||
/** This is the general function used to get access to a database page.
|
||||
|
@ -559,7 +509,7 @@ BUF_PEEK_IF_IN_POOL, BUF_GET_NO_LATCH, or BUF_GET_IF_IN_POOL_OR_WATCH
|
|||
@return pointer to the block or NULL */
|
||||
buf_block_t*
|
||||
buf_page_get_gen(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint rw_latch,
|
||||
buf_block_t* guess,
|
||||
|
@ -579,7 +529,7 @@ FILE_PAGE (the other is buf_page_get_gen).
|
|||
@return pointer to the block, page bufferfixed */
|
||||
buf_block_t*
|
||||
buf_page_create(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
mtr_t* mtr);
|
||||
|
||||
|
@ -613,10 +563,7 @@ NOTE that it is possible that the page is not yet read from disk,
|
|||
though.
|
||||
@param[in] page_id page id
|
||||
@return TRUE if found in the page hash table */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
buf_page_peek(
|
||||
const page_id_t& page_id);
|
||||
inline bool buf_page_peek(const page_id_t page_id);
|
||||
|
||||
#ifdef UNIV_DEBUG
|
||||
|
||||
|
@ -626,9 +573,7 @@ debug version to check that it is not accessed any more unless
|
|||
reallocated.
|
||||
@param[in] page_id page id
|
||||
@return control block if found in page hash table, otherwise NULL */
|
||||
buf_page_t*
|
||||
buf_page_set_file_page_was_freed(
|
||||
const page_id_t& page_id);
|
||||
buf_page_t* buf_page_set_file_page_was_freed(const page_id_t page_id);
|
||||
|
||||
/** Sets file_page_was_freed FALSE if the page is found in the buffer pool.
|
||||
This function should be called when we free a file page and want the
|
||||
|
@ -636,9 +581,7 @@ debug version to check that it is not accessed any more unless
|
|||
reallocated.
|
||||
@param[in] page_id page id
|
||||
@return control block if found in page hash table, otherwise NULL */
|
||||
buf_page_t*
|
||||
buf_page_reset_file_page_was_freed(
|
||||
const page_id_t& page_id);
|
||||
buf_page_t* buf_page_reset_file_page_was_freed(const page_id_t page_id);
|
||||
|
||||
#endif /* UNIV_DEBUG */
|
||||
/********************************************************************//**
|
||||
|
@ -1086,7 +1029,7 @@ UNIV_INLINE
|
|||
void
|
||||
buf_block_set_file_page(
|
||||
buf_block_t* block,
|
||||
const page_id_t& page_id);
|
||||
const page_id_t page_id);
|
||||
|
||||
/*********************************************************************//**
|
||||
Gets the io_fix state of a block.
|
||||
|
@ -1267,7 +1210,7 @@ buf_page_t*
|
|||
buf_page_init_for_read(
|
||||
dberr_t* err,
|
||||
ulint mode,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
bool unzip);
|
||||
|
||||
|
@ -1315,10 +1258,7 @@ buf_pool_from_block(
|
|||
/** Returns the buffer pool instance given a page id.
|
||||
@param[in] page_id page id
|
||||
@return buffer pool */
|
||||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_get(
|
||||
const page_id_t& page_id);
|
||||
inline buf_pool_t* buf_pool_get(const page_id_t page_id);
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the buffer pool instance given its array index
|
||||
|
@ -1338,7 +1278,7 @@ UNIV_INLINE
|
|||
buf_page_t*
|
||||
buf_page_hash_get_low(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id);
|
||||
const page_id_t page_id);
|
||||
|
||||
/** Returns the control block of a file page, NULL if not found.
|
||||
If the block is found and lock is not NULL then the appropriate
|
||||
|
@ -1360,7 +1300,7 @@ UNIV_INLINE
|
|||
buf_page_t*
|
||||
buf_page_hash_get_locked(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
rw_lock_t** lock,
|
||||
ulint lock_mode,
|
||||
bool watch = false);
|
||||
|
@ -1383,7 +1323,7 @@ UNIV_INLINE
|
|||
buf_block_t*
|
||||
buf_block_hash_get_locked(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
rw_lock_t** lock,
|
||||
ulint lock_mode);
|
||||
|
||||
|
@ -1423,18 +1363,14 @@ buf_pool_watch_is_sentinel(
|
|||
/** Stop watching if the page has been read in.
|
||||
buf_pool_watch_set(space,offset) must have returned NULL before.
|
||||
@param[in] page_id page id */
|
||||
void
|
||||
buf_pool_watch_unset(
|
||||
const page_id_t& page_id);
|
||||
void buf_pool_watch_unset(const page_id_t page_id);
|
||||
|
||||
/** Check if the page has been read in.
|
||||
This may only be called after buf_pool_watch_set(space,offset)
|
||||
has returned NULL and before invoking buf_pool_watch_unset(space,offset).
|
||||
@param[in] page_id page id
|
||||
@return FALSE if the given page was not read in, TRUE if it was */
|
||||
ibool
|
||||
buf_pool_watch_occurred(
|
||||
const page_id_t& page_id)
|
||||
bool buf_pool_watch_occurred(const page_id_t page_id)
|
||||
MY_ATTRIBUTE((warn_unused_result));
|
||||
|
||||
/********************************************************************//**
|
||||
|
|
|
@ -463,10 +463,10 @@ UNIV_INLINE
|
|||
void
|
||||
buf_block_set_file_page(
|
||||
buf_block_t* block,
|
||||
const page_id_t& page_id)
|
||||
const page_id_t page_id)
|
||||
{
|
||||
buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
|
||||
block->page.id.copy_from(page_id);
|
||||
block->page.id = page_id;
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
|
@ -1042,10 +1042,7 @@ buf_block_buf_fix_dec(
|
|||
/** Returns the buffer pool instance given a page id.
|
||||
@param[in] page_id page id
|
||||
@return buffer pool */
|
||||
UNIV_INLINE
|
||||
buf_pool_t*
|
||||
buf_pool_get(
|
||||
const page_id_t& page_id)
|
||||
inline buf_pool_t* buf_pool_get(const page_id_t page_id)
|
||||
{
|
||||
/* 2log of BUF_READ_AHEAD_AREA (64) */
|
||||
ulint ignored_page_no = page_id.page_no() >> 6;
|
||||
|
@ -1080,7 +1077,7 @@ UNIV_INLINE
|
|||
buf_page_t*
|
||||
buf_page_hash_get_low(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id)
|
||||
const page_id_t page_id)
|
||||
{
|
||||
buf_page_t* bpage;
|
||||
|
||||
|
@ -1098,7 +1095,7 @@ buf_page_hash_get_low(
|
|||
bpage,
|
||||
ut_ad(bpage->in_page_hash && !bpage->in_zip_hash
|
||||
&& buf_page_in_file(bpage)),
|
||||
page_id.equals_to(bpage->id));
|
||||
page_id == bpage->id);
|
||||
if (bpage) {
|
||||
ut_a(buf_page_in_file(bpage));
|
||||
ut_ad(bpage->in_page_hash);
|
||||
|
@ -1129,7 +1126,7 @@ UNIV_INLINE
|
|||
buf_page_t*
|
||||
buf_page_hash_get_locked(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
rw_lock_t** lock,
|
||||
ulint lock_mode,
|
||||
bool watch)
|
||||
|
@ -1173,7 +1170,7 @@ buf_page_hash_get_locked(
|
|||
}
|
||||
|
||||
ut_ad(buf_page_in_file(bpage));
|
||||
ut_ad(page_id.equals_to(bpage->id));
|
||||
ut_ad(page_id == bpage->id);
|
||||
|
||||
if (lock == NULL) {
|
||||
/* The caller wants us to release the page_hash lock */
|
||||
|
@ -1212,7 +1209,7 @@ UNIV_INLINE
|
|||
buf_block_t*
|
||||
buf_block_hash_get_locked(
|
||||
buf_pool_t* buf_pool,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
rw_lock_t** lock,
|
||||
ulint lock_mode)
|
||||
{
|
||||
|
@ -1252,11 +1249,8 @@ buf_block_hash_get_locked(
|
|||
NOTE that it is possible that the page is not yet read from disk,
|
||||
though.
|
||||
@param[in] page_id page id
|
||||
@return TRUE if found in the page hash table */
|
||||
UNIV_INLINE
|
||||
ibool
|
||||
buf_page_peek(
|
||||
const page_id_t& page_id)
|
||||
@return true if found in the page hash table */
|
||||
inline bool buf_page_peek(const page_id_t page_id)
|
||||
{
|
||||
buf_pool_t* buf_pool = buf_pool_get(page_id);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ after decryption normal page checksum does not match.
|
|||
@retval DB_TABLESPACE_DELETED if tablespace .ibd file is missing */
|
||||
dberr_t
|
||||
buf_read_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size);
|
||||
|
||||
/********************************************************************//**
|
||||
|
@ -57,7 +57,7 @@ released by the i/o-handler thread.
|
|||
@param[in] sync true if synchronous aio is desired */
|
||||
void
|
||||
buf_read_page_background(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
bool sync);
|
||||
|
||||
|
@ -79,7 +79,7 @@ pages, it may happen that the page at the given page number does not
|
|||
get read even if we return a positive value! */
|
||||
ulint
|
||||
buf_read_ahead_random(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ibool inside_ibuf);
|
||||
|
||||
|
@ -111,7 +111,7 @@ which could result in a deadlock if the OS does not support asynchronous io.
|
|||
@return number of page read requests issued */
|
||||
ulint
|
||||
buf_read_ahead_linear(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ibool inside_ibuf);
|
||||
|
||||
|
|
|
@ -40,8 +40,8 @@ Created 10/25/1995 Heikki Tuuri
|
|||
// Forward declaration
|
||||
extern ibool srv_use_doublewrite_buf;
|
||||
extern struct buf_dblwr_t* buf_dblwr;
|
||||
struct trx_t;
|
||||
class page_id_t;
|
||||
struct trx_t;
|
||||
class truncate_t;
|
||||
|
||||
typedef std::list<char*, ut_allocator<char*> > space_name_list_t;
|
||||
|
@ -1244,7 +1244,7 @@ dberr_t
|
|||
fil_io(
|
||||
const IORequest& type,
|
||||
bool sync,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
ulint byte_offset,
|
||||
ulint len,
|
||||
|
@ -1315,65 +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 */
|
||||
inline
|
||||
void
|
||||
fil_page_check_type(
|
||||
const page_id_t& page_id,
|
||||
byte* page,
|
||||
ulint type,
|
||||
mtr_t* mtr)
|
||||
{
|
||||
ulint page_type = fil_page_get_type(page);
|
||||
|
||||
if (page_type != type) {
|
||||
fil_page_reset_type(page_id, page, type, mtr);
|
||||
}
|
||||
}
|
||||
|
||||
/** 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,out] block block with possibly invalid FIL_PAGE_TYPE
|
||||
@param[in] type expected page type
|
||||
@param[in,out] mtr mini-transaction */
|
||||
#define fil_block_check_type(block, type, mtr) \
|
||||
fil_page_check_type(block->page.id, block->frame, type, 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
|
||||
|
@ -647,7 +685,7 @@ fseg_free_step_not_header_func(
|
|||
UNIV_INLINE
|
||||
ibool
|
||||
fsp_descr_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size);
|
||||
|
||||
/***********************************************************//**
|
||||
|
|
|
@ -33,7 +33,7 @@ Created 12/18/1995 Heikki Tuuri
|
|||
UNIV_INLINE
|
||||
ibool
|
||||
fsp_descr_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
return((page_id.page_no() & (page_size.physical() - 1))
|
||||
|
|
|
@ -251,7 +251,7 @@ ibuf_inside(
|
|||
UNIV_INLINE
|
||||
ibool
|
||||
ibuf_bitmap_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size);
|
||||
|
||||
/** Checks if a page is a level 2 or 3 page in the ibuf hierarchy of pages.
|
||||
|
@ -268,7 +268,7 @@ in which case a new transaction is created.
|
|||
@return TRUE if level 2 or level 3 page */
|
||||
ibool
|
||||
ibuf_page_low(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
#ifdef UNIV_DEBUG
|
||||
ibool x_latch,
|
||||
|
@ -324,7 +324,7 @@ ibuf_insert(
|
|||
ibuf_op_t op,
|
||||
const dtuple_t* entry,
|
||||
dict_index_t* index,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size,
|
||||
que_thr_t* thr);
|
||||
|
||||
|
@ -343,7 +343,7 @@ want to update a non-existent bitmap page */
|
|||
void
|
||||
ibuf_merge_or_delete_for_page(
|
||||
buf_block_t* block,
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t* page_size,
|
||||
ibool update_ibuf_bitmap);
|
||||
|
||||
|
@ -391,9 +391,7 @@ ibuf_parse_bitmap_init(
|
|||
@param[in] page_id page id
|
||||
@return number of entries in the insert buffer currently buffered for
|
||||
this page */
|
||||
ulint
|
||||
ibuf_count_get(
|
||||
const page_id_t& page_id);
|
||||
ulint ibuf_count_get(const page_id_t page_id);
|
||||
#endif
|
||||
/******************************************************************//**
|
||||
Looks if the insert buffer is empty.
|
||||
|
|
|
@ -156,7 +156,7 @@ ibuf_inside(
|
|||
UNIV_INLINE
|
||||
ibool
|
||||
ibuf_bitmap_page(
|
||||
const page_id_t& page_id,
|
||||
const page_id_t page_id,
|
||||
const page_size_t& page_size)
|
||||
{
|
||||
return((page_id.page_no() & (page_size.physical() - 1))
|
||||
|
|
|
@ -1240,7 +1240,7 @@ void
|
|||
page_warn_strict_checksum(
|
||||
srv_checksum_algorithm_t curr_algo,
|
||||
srv_checksum_algorithm_t page_checksum,
|
||||
const page_id_t& page_id);
|
||||
const page_id_t page_id);
|
||||
|
||||
#ifdef UNIV_MATERIALIZE
|
||||
#undef UNIV_INLINE
|
||||
|
|
|
@ -57,10 +57,7 @@ extern trx_sys_t* trx_sys;
|
|||
/** Checks if a page address is the trx sys header page.
|
||||
@param[in] page_id page id
|
||||
@return true if trx sys header page */
|
||||
UNIV_INLINE
|
||||
bool
|
||||
trx_sys_hdr_page(
|
||||
const page_id_t& page_id);
|
||||
inline bool trx_sys_hdr_page(const page_id_t page_id);
|
||||
|
||||
/** Initialize the transaction system main-memory data structures. */
|
||||
void trx_sys_init_at_db_start();
|
||||
|
|
|
@ -54,10 +54,7 @@ trx_sys_flush_max_trx_id(void);
|
|||
/** Checks if a page address is the trx sys header page.
|
||||
@param[in] page_id page id
|
||||
@return true if trx sys header page */
|
||||
UNIV_INLINE
|
||||
bool
|
||||
trx_sys_hdr_page(
|
||||
const page_id_t& page_id)
|
||||
inline bool trx_sys_hdr_page(const page_id_t page_id)
|
||||
{
|
||||
return(page_id.space() == TRX_SYS_SPACE
|
||||
&& page_id.page_no() == TRX_SYS_PAGE_NO);
|
||||
|
|
|
@ -107,7 +107,7 @@ trx_read_roll_ptr(
|
|||
@return pointer to page x-latched */
|
||||
UNIV_INLINE
|
||||
page_t*
|
||||
trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr);
|
||||
trx_undo_page_get(const page_id_t page_id, mtr_t* mtr);
|
||||
|
||||
/** Gets an undo log page and s-latches it.
|
||||
@param[in] page_id page id
|
||||
|
@ -115,7 +115,7 @@ trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr);
|
|||
@return pointer to page s-latched */
|
||||
UNIV_INLINE
|
||||
page_t*
|
||||
trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr);
|
||||
trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr);
|
||||
|
||||
/******************************************************************//**
|
||||
Returns the previous undo record on the page in the specified log, or
|
||||
|
|
|
@ -158,7 +158,7 @@ trx_read_roll_ptr(
|
|||
@return pointer to page x-latched */
|
||||
UNIV_INLINE
|
||||
page_t*
|
||||
trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr)
|
||||
trx_undo_page_get(const page_id_t page_id, mtr_t* mtr)
|
||||
{
|
||||
buf_block_t* block = buf_page_get(page_id, univ_page_size,
|
||||
RW_X_LATCH, mtr);
|
||||
|
@ -174,7 +174,7 @@ trx_undo_page_get(const page_id_t& page_id, mtr_t* mtr)
|
|||
@return pointer to page s-latched */
|
||||
UNIV_INLINE
|
||||
page_t*
|
||||
trx_undo_page_get_s_latched(const page_id_t& page_id, mtr_t* mtr)
|
||||
trx_undo_page_get_s_latched(const page_id_t page_id, mtr_t* mtr)
|
||||
{
|
||||
buf_block_t* block = buf_page_get(page_id, univ_page_size,
|
||||
RW_S_LATCH, mtr);
|
||||
|
|
|
@ -2128,10 +2128,7 @@ recv_recover_page(bool just_read_in, buf_block_t* block)
|
|||
page number.
|
||||
@param[in] page_id page id
|
||||
@return number of pages found */
|
||||
static
|
||||
ulint
|
||||
recv_read_in_area(
|
||||
const page_id_t& page_id)
|
||||
static ulint recv_read_in_area(const page_id_t page_id)
|
||||
{
|
||||
recv_addr_t* recv_addr;
|
||||
ulint page_nos[RECV_READ_AHEAD_AREA];
|
||||
|
|
|
@ -2833,7 +2833,7 @@ void
|
|||
page_warn_strict_checksum(
|
||||
srv_checksum_algorithm_t curr_algo,
|
||||
srv_checksum_algorithm_t page_checksum,
|
||||
const page_id_t& page_id)
|
||||
const page_id_t page_id)
|
||||
{
|
||||
srv_checksum_algorithm_t curr_algo_nonstrict;
|
||||
switch (curr_algo) {
|
||||
|
|
|
@ -3668,7 +3668,7 @@ fil_tablespace_iterate(
|
|||
buf_block_t* block = reinterpret_cast<buf_block_t*>
|
||||
(ut_zalloc_nokey(sizeof *block));
|
||||
block->frame = page;
|
||||
block->page.id.copy_from(page_id_t(0, 0));
|
||||
block->page.id = page_id_t(0, 0);
|
||||
block->page.io_fix = BUF_IO_NONE;
|
||||
block->page.buf_fix_count = 1;
|
||||
block->page.state = BUF_BLOCK_FILE_PAGE;
|
||||
|
@ -3686,8 +3686,7 @@ fil_tablespace_iterate(
|
|||
}
|
||||
|
||||
if (err == DB_SUCCESS) {
|
||||
block->page.id.copy_from(
|
||||
page_id_t(callback.get_space_id(), 0));
|
||||
block->page.id = page_id_t(callback.get_space_id(), 0);
|
||||
block->page.size.copy_from(callback.get_page_size());
|
||||
if (block->page.size.is_compressed()) {
|
||||
page_zip_set_size(&block->page.zip,
|
||||
|
|
|
@ -2453,24 +2453,24 @@ files_checked:
|
|||
page_id_t(IBUF_SPACE_ID,
|
||||
FSP_IBUF_HEADER_PAGE_NO),
|
||||
univ_page_size, RW_X_LATCH, &mtr);
|
||||
fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr);
|
||||
fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
|
||||
/* Already MySQL 3.23.53 initialized
|
||||
FSP_IBUF_TREE_ROOT_PAGE_NO to
|
||||
FIL_PAGE_INDEX. No need to reset that one. */
|
||||
block = buf_page_get(
|
||||
page_id_t(TRX_SYS_SPACE, TRX_SYS_PAGE_NO),
|
||||
univ_page_size, RW_X_LATCH, &mtr);
|
||||
fil_block_check_type(block, FIL_PAGE_TYPE_TRX_SYS,
|
||||
fil_block_check_type(*block, FIL_PAGE_TYPE_TRX_SYS,
|
||||
&mtr);
|
||||
block = buf_page_get(
|
||||
page_id_t(TRX_SYS_SPACE,
|
||||
FSP_FIRST_RSEG_PAGE_NO),
|
||||
univ_page_size, RW_X_LATCH, &mtr);
|
||||
fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr);
|
||||
fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
|
||||
block = buf_page_get(
|
||||
page_id_t(TRX_SYS_SPACE, FSP_DICT_HDR_PAGE_NO),
|
||||
univ_page_size, RW_X_LATCH, &mtr);
|
||||
fil_block_check_type(block, FIL_PAGE_TYPE_SYS, &mtr);
|
||||
fil_block_check_type(*block, FIL_PAGE_TYPE_SYS, &mtr);
|
||||
mtr.commit();
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue