|
|
@ -223,25 +223,29 @@ 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(static_cast<uint32_t>(space)), |
|
|
|
m_page_no(static_cast<uint32_t>(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 |
|
|
|
inline uint32_t space() const |
|
|
|
{ |
|
|
|
return(m_space); |
|
|
|
} |
|
|
|
|
|
|
|
/** Retrieve the page number. |
|
|
|
@return page number */ |
|
|
|
inline ib_uint32_t page_no() const |
|
|
|
inline uint32_t page_no() const |
|
|
|
{ |
|
|
|
return(m_page_no); |
|
|
|
} |
|
|
@ -250,69 +254,25 @@ public: |
|
|
|
@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); |
|
|
|
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 = static_cast<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 +284,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 +294,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 +477,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 +503,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 +519,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 +539,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 +573,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 +583,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 +591,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 +1039,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 +1220,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 +1268,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 +1288,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 +1310,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 +1333,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 +1373,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)); |
|
|
|
|
|
|
|
/********************************************************************//** |
|
|
|