Browse Source

MDEV-31827 InnoDB multi-batch recovery stops prematurely

recv_scan_log(): On recv_sys_t::PREMATURE_EOF, keep reading more log
if recv_sys.lsn < recv_sys.scanned_lsn.

recv_recovery_from_checkpoint_start(): Add a safety check to abort
crash recovery if recv_sys.lsn is not recv_sys.scanned_lsn.

This fixes a serious database corruption bug that was introduced by
commit 2f9e264781 (MDEV-29911).
bb-10.9-MDEV-30100
Marko Mäkelä 2 years ago
parent
commit
a89527e127
  1. 10
      storage/innobase/log/log0recv.cc

10
storage/innobase/log/log0recv.cc

@ -4147,7 +4147,8 @@ static bool recv_scan_log(bool last_phase)
if (recv_sys.is_corrupt_log())
break;
if (recv_sys.offset < log_sys.get_block_size())
if (recv_sys.offset < log_sys.get_block_size() &&
recv_sys.lsn == recv_sys.scanned_lsn)
goto got_eof;
if (recv_sys.offset > buf_size / 4 ||
@ -4662,6 +4663,13 @@ err_exit:
}
mysql_mutex_lock(&recv_sys.mutex);
if (UNIV_UNLIKELY(recv_sys.scanned_lsn != recv_sys.lsn)
&& log_sys.is_latest()) {
ut_ad("log parsing error" == 0);
mysql_mutex_unlock(&recv_sys.mutex);
err = DB_CORRUPTION;
goto early_exit;
}
recv_sys.apply_log_recs = true;
recv_no_ibuf_operations = false;
ut_d(recv_no_log_write = srv_operation == SRV_OPERATION_RESTORE

Loading…
Cancel
Save