Commit 522fbfcb authored by Marko Mäkelä's avatar Marko Mäkelä

Cleanup: Remove recv_sys.buf_size

Also, correctly document what recv_sys.mutex is protecting.
parent 0a9633ee
......@@ -149,7 +149,7 @@ struct recv_dblwr_t {
/** the recovery state and buffered records for a page */
struct page_recv_t
{
/** Recovery state */
/** Recovery state; protected by recv_sys.mutex */
enum
{
/** not yet processed */
......@@ -216,10 +216,14 @@ struct page_recv_t
};
/** Recovery system data structure */
struct recv_sys_t{
ib_mutex_t mutex; /*!< mutex protecting the fields apply_log_recs,
n_addrs, and the state field in each recv_addr
struct */
struct recv_sys_t
{
/** mutex protecting apply_log_recs and page_recv_t::state */
ib_mutex_t mutex;
/** whether recv_recover_page(), invoked from buf_page_io_complete(),
should apply log records*/
bool apply_log_recs;
ib_mutex_t writer_mutex;/*!< mutex coordinating
flushing between recv_writer_thread and
the recovery thread. */
......@@ -230,13 +234,9 @@ struct recv_sys_t{
buf_flush_t flush_type;/*!< type of the flush request.
BUF_FLUSH_LRU: flush end of LRU, keeping free blocks.
BUF_FLUSH_LIST: flush all of blocks. */
/** whether recv_recover_page(), invoked from buf_page_io_complete(),
should apply log records*/
bool apply_log_recs;
/** whether recv_apply_hashed_log_recs() is running */
bool apply_batch_on;
byte* buf; /*!< buffer for parsing log records */
size_t buf_size; /*!< size of buf */
ulint len; /*!< amount of data in buf */
lsn_t parse_start_lsn;
/*!< this is the lsn from which we were able to
......@@ -294,7 +294,7 @@ struct recv_sys_t{
recv_dblwr_t dblwr;
/** Last added LSN to pages. */
lsn_t last_stored_lsn;
lsn_t last_stored_lsn= 0;
/** After successful upgrade from multiple redo log files we'd like
to remove extra ones */
......@@ -339,7 +339,7 @@ struct recv_sys_t{
/** Clean up after create() */
void close();
bool is_initialised() const { return buf_size != 0; }
bool is_initialised() const { return last_stored_lsn != 0; }
/** Register a redo log snippet for a page.
@param page_id page identifier
......
......@@ -902,11 +902,11 @@ void recv_sys_t::close()
}
if (buf) {
ut_free_dodump(buf, buf_size);
ut_free_dodump(buf, RECV_PARSING_BUF_SIZE);
buf = NULL;
}
buf_size = 0;
last_stored_lsn = 0;
mutex_free(&writer_mutex);
mutex_free(&mutex);
}
......@@ -1009,7 +1009,6 @@ void recv_sys_t::create()
max_log_blocks = buf_pool_get_n_pages() / 3;
buf = static_cast<byte*>(ut_malloc_dontdump(RECV_PARSING_BUF_SIZE));
buf_size = RECV_PARSING_BUF_SIZE;
len = 0;
parse_start_lsn = 0;
scanned_lsn = 0;
......@@ -1024,7 +1023,7 @@ void recv_sys_t::create()
recv_max_page_lsn = 0;
memset(truncated_undo_spaces, 0, sizeof truncated_undo_spaces);
last_stored_lsn = 0;
last_stored_lsn = 1;
UT_LIST_INIT(blocks, &buf_block_t::unzip_LRU);
}
......@@ -1055,7 +1054,7 @@ void recv_sys_t::debug_free()
mutex_enter(&mutex);
pages.clear();
ut_free_dodump(buf, buf_size);
ut_free_dodump(buf, RECV_PARSING_BUF_SIZE);
buf = NULL;
......
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