Bug #91725 mysql hangs if find corrupt page during crash recovery
Submitted: 20 Jul 2018 9:25 Modified: 20 Jul 2018 13:21
Reporter: zhai weixiang (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:8.0 OS:Any
Assigned to: CPU Architecture:Any

[20 Jul 2018 9:25] zhai weixiang
During log application, recv_apply_hashed_log_recs is invoked. It asks the background io threads to read in page from disk, and the main thread will wait until recv_sys->n_addrs decreases to zero.   

But in function buf_page_io_complete(), when it found the page is corrupted, it'll report some error message, and then directly return, without reducing recv_sys->n_addrs

How to repeat:
read the code 

Suggested fix:
Mark the recv_addr in hash to RECV_PROCESSED, and decrease recv_sys->n_addrs if encountering a corrupted page.
[20 Jul 2018 13:17] MySQL Verification Team

Thank you for the bug report.

We have looked into it and came to certain conclusions.

There are cases when a field recv_sys->n_addrs is not decremented !!! It will only occur when  srv_force_recovery  is less then SRV_FORCE_IGNORE_CORRUPT.

As we do not know your settings, nor other details, we would like to know if that is the case. You can find it out by debugging through that part of code when InnoDB discovers corrupted page(s).
[20 Jul 2018 13:21] MySQL Verification Team

On further analysis, we discovered that  buf_read_page_handle_error() is not decrementing that field and if code  returns from there it will indicate still log records exist in hash.

Hence, this bug is verified.