Bug#16405422 - RECOVERY FAILURE, ASSERT !RECV_NO_LOG_WRITE

eliminate a race condition over recv_sys->n_addrs which might result in a database corruption
in recovery, without reporting a recovery error.

recv_recover_page_func(): move the code segment that decrements recv_sys->n_addrs
  to the end of the function, after the call to mtr_commit()

rb://2282 approved by Inaam
parent ed694b0c
......@@ -1301,6 +1301,19 @@ recv_recover_page(
recv = UT_LIST_GET_NEXT(rec_list, recv);
}
if (!recover_backup && modification_to_page) {
ut_a(block);
buf_flush_recv_note_modification(block, start_lsn, end_lsn);
}
/* Make sure that committing mtr does not change the modification
lsn values of page */
mtr.modifications = FALSE;
mtr_commit(&mtr);
mutex_enter(&(recv_sys->mutex));
if (ut_dulint_cmp(recv_max_page_lsn, page_lsn) < 0) {
......@@ -1314,18 +1327,6 @@ recv_recover_page(
mutex_exit(&(recv_sys->mutex));
if (!recover_backup && modification_to_page) {
ut_a(block);
buf_flush_recv_note_modification(block, start_lsn, end_lsn);
}
/* Make sure that committing mtr does not change the modification
lsn values of page */
mtr.modifications = FALSE;
mtr_commit(&mtr);
}
/***********************************************************************
......
......@@ -1638,19 +1638,6 @@ recv_recover_page_func(
}
#endif /* UNIV_ZIP_DEBUG */
mutex_enter(&(recv_sys->mutex));
if (recv_max_page_lsn < page_lsn) {
recv_max_page_lsn = page_lsn;
}
recv_addr->state = RECV_PROCESSED;
ut_a(recv_sys->n_addrs);
recv_sys->n_addrs--;
mutex_exit(&(recv_sys->mutex));
#ifndef UNIV_HOTBACKUP
if (modification_to_page) {
ut_a(block);
......@@ -1665,6 +1652,20 @@ recv_recover_page_func(
mtr.modifications = FALSE;
mtr_commit(&mtr);
mutex_enter(&(recv_sys->mutex));
if (recv_max_page_lsn < page_lsn) {
recv_max_page_lsn = page_lsn;
}
recv_addr->state = RECV_PROCESSED;
ut_a(recv_sys->n_addrs);
recv_sys->n_addrs--;
mutex_exit(&(recv_sys->mutex));
}
#ifndef UNIV_HOTBACKUP
......
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