summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2020-03-07 11:30:45 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2020-03-07 12:01:12 +0200
commit522fbfcb5cf655851ce4ee4deaccfe430942f6ce (patch)
tree1f24c5200034c7c03ff7924952ac0f97a4b3a3ba
parent0a9633ee62489a56f6122be920359007bbc0bfe2 (diff)
downloadmariadb-git-522fbfcb5cf655851ce4ee4deaccfe430942f6ce.tar.gz
Cleanup: Remove recv_sys.buf_size
Also, correctly document what recv_sys.mutex is protecting.
-rw-r--r--storage/innobase/include/log0recv.h22
-rw-r--r--storage/innobase/log/log0recv.cc9
2 files changed, 15 insertions, 16 deletions
diff --git a/storage/innobase/include/log0recv.h b/storage/innobase/include/log0recv.h
index 1e6a031d15f..8a2b688f802 100644
--- a/storage/innobase/include/log0recv.h
+++ b/storage/innobase/include/log0recv.h
@@ -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 @@ public:
/** 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
diff --git a/storage/innobase/log/log0recv.cc b/storage/innobase/log/log0recv.cc
index b2cc7248b1d..75094e463e7 100644
--- a/storage/innobase/log/log0recv.cc
+++ b/storage/innobase/log/log0recv.cc
@@ -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;