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

Cleanup: More logical names and member functions

recv_sys_t::free_corrupted_page(): Renamed from recv_recover_corrupt_page().

recv_sys_t::is_memory_exhausted(): Renamed from recv_sys_heap_check().

recv_sys_t::max_blocks(): Accessor for max_log_blocks.

recv_sys_t::blocks: Buffer pool blocks reserved for redo log records.

For the debug functions related to recv_sys_t::alloc(), use the
logical name free().

Rename some variables 'store_to_hash' to 'store', because recv_sys.pages
is not a hash table.
parent 036dc4f4
......@@ -5984,7 +5984,7 @@ buf_page_io_complete(buf_page_t* bpage, bool dblwr, bool evict)
buf_corrupt_page_release(bpage, space);
if (recv_recovery_is_on()) {
recv_recover_corrupt_page(corrupt_page_id);
recv_sys.free_corrupted_page(corrupt_page_id);
}
space->release_for_io();
......
......@@ -766,7 +766,7 @@ buf_read_recv_pages(
ulint count = 0;
buf_pool = buf_pool_get(cur_page_id);
while (buf_pool->n_pend_reads >= recv_sys.max_log_blocks / 2) {
while (buf_pool->n_pend_reads >= recv_sys.max_blocks() / 2) {
os_thread_sleep(10000);
......
......@@ -47,11 +47,6 @@ dberr_t
recv_find_max_checkpoint(ulint* max_field)
MY_ATTRIBUTE((nonnull, warn_unused_result));
/** Remove records for a corrupted page.
This function should called when srv_force_recovery > 0.
@param[in] page_id page id of the corrupted page */
ATTRIBUTE_COLD void recv_recover_corrupt_page(page_id_t page_id);
/** Apply any buffered redo log to a page that was just read from a data file.
@param[in,out] bpage buffer pool page */
ATTRIBUTE_COLD void recv_recover_page(buf_page_t* bpage);
......@@ -222,7 +217,8 @@ struct page_recv_t
bool empty() const { ut_ad(!head == !tail); return !head; }
inline void clear();
#ifdef UNIV_DEBUG
inline void unfix();
/** Declare the records as freed; @see recv_sys_t::alloc() */
inline void free() const;
#endif
} log;
......@@ -230,7 +226,6 @@ struct page_recv_t
inline void will_not_read();
/** @return whether the log records for the page are being processed */
bool is_being_processed() const { return state == RECV_BEING_PROCESSED; }
};
/** Recovery system data structure */
......@@ -314,16 +309,25 @@ struct recv_sys_t{
/** Last added LSN to pages. */
lsn_t last_stored_lsn;
/** Maximum number of buffer pool blocks to allocate for redo
log records */
ulint max_log_blocks;
/** Base node of the redo block list (up to max_log_blocks)
List elements are linked via buf_block_t::unzip_LRU. */
UT_LIST_BASE_NODE_T(buf_block_t) redo_list;
private:
/** Maximum number of buffer pool blocks to allocate for redo log records */
ulint max_log_blocks;
/** Base node of the redo block list (up to max_log_blocks)
List elements are linked via buf_block_t::unzip_LRU. */
UT_LIST_BASE_NODE_T(buf_block_t) blocks;
public:
/** @return the maximum number of buffer pool blocks for log records */
ulint max_blocks() const { return max_log_blocks; }
/** Check whether the number of read redo log blocks exceeds the maximum.
Store last_stored_lsn if the recovery is not in the last phase.
@param[in,out] store whether to store page operations
@return whether the memory is exhausted */
inline bool is_memory_exhausted(store_t *store);
#ifdef UNIV_DEBUG
bool after_apply= false;
/** whether all redo log in the current batch has been applied */
bool after_apply= false;
#endif
/** Initialize the redo log recovery subsystem. */
void create();
......@@ -371,14 +375,24 @@ struct recv_sys_t{
inline byte *alloc(size_t len, bool store_recv= false);
#ifdef UNIV_DEBUG
/** Find the redo_list element corresponding to a redo log record.
private:
/** Find the buffer pool block that is storing a redo log record.
@param[in] data pointer to buffer returned by alloc()
@return redo list element */
buf_block_t *find_block(const void *data) const;
inline buf_block_t *find_block(const void *data) const;
public:
/** Declare a redo log record freed from a buffer pool block.
@param[in] data pointer to buffer returned by alloc() */
inline void free(const void *data) const;
#endif
/** @return the free length of the latest alloc() block, in bytes */
inline size_t get_free_len() const;
/** Remove records for a corrupted page.
This function should only be called when innodb_force_recovery is set.
@param page_id corrupted page identifier */
ATTRIBUTE_COLD void free_corrupted_page(page_id_t page_id);
};
/** The recovery system */
......
This diff is collapsed.
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