MDEV-30673 InnoDB recovery hangs when buf_LRU_get_free_block

			is being called

- Recovery fails to release log_sys.latch for non-last batch
before preallocates the block in recv_read_in_area().
parent da114c70
...@@ -3147,10 +3147,12 @@ bool recv_recover_page(fil_space_t* space, buf_page_t* bpage) ...@@ -3147,10 +3147,12 @@ bool recv_recover_page(fil_space_t* space, buf_page_t* bpage)
} }
/** Read pages for which log needs to be applied. /** Read pages for which log needs to be applied.
@param page_id first page identifier to read @param page_id first page identifier to read
@param i iterator to recv_sys.pages */ @param i iterator to recv_sys.pages
@param last_batch whether it is possible to write more redo log */
TRANSACTIONAL_TARGET TRANSACTIONAL_TARGET
static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i) static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i,
bool last_batch)
{ {
uint32_t page_nos[32]; uint32_t page_nos[32];
ut_ad(page_id == i->first); ut_ad(page_id == i->first);
...@@ -3170,7 +3172,9 @@ static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i) ...@@ -3170,7 +3172,9 @@ static void recv_read_in_area(page_id_t page_id, recv_sys_t::map::iterator i)
if (p != page_nos) if (p != page_nos)
{ {
mysql_mutex_unlock(&recv_sys.mutex); mysql_mutex_unlock(&recv_sys.mutex);
if (!last_batch) log_sys.latch.wr_unlock();
buf_read_recv_pages(page_id.space(), {page_nos, p}); buf_read_recv_pages(page_id.space(), {page_nos, p});
if (!last_batch) log_sys.latch.wr_lock(SRW_LOCK_CALL);
mysql_mutex_lock(&recv_sys.mutex); mysql_mutex_lock(&recv_sys.mutex);
} }
} }
...@@ -3459,7 +3463,7 @@ void recv_sys_t::apply(bool last_batch) ...@@ -3459,7 +3463,7 @@ void recv_sys_t::apply(bool last_batch)
ut_ad(p == pages.end() || p->first > page_id); ut_ad(p == pages.end() || p->first > page_id);
continue; continue;
case page_recv_t::RECV_NOT_PROCESSED: case page_recv_t::RECV_NOT_PROCESSED:
recv_read_in_area(page_id, p); recv_read_in_area(page_id, p, last_batch);
} }
p= pages.lower_bound(page_id); p= pages.lower_bound(page_id);
/* Ensure that progress will be made. */ /* Ensure that progress will be made. */
......
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