Bug #70811 buf_flush_event initialized too late
Submitted: 4 Nov 2013 17:28 Modified: 6 Nov 2013 12:16
Reporter: Inaam Rana (OCA) Email Updates:
Status: Verified Impact on me:
Category:MySQL Server: InnoDB storage engine Severity:S3 (Non-critical)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[4 Nov 2013 17:28] Inaam Rana
There is one bug and two suggestions to improve on buf_flush_event that is used to signal page_cleaner thread to do LRU flushing.

1) buf_flush_event is initialized in page_cleaner thread startup. This is too late in the initialization process. Note that page_cleaner thread is spawned after recovery, if needed, is finished and other initialization has happened. That means during recovery process or during initialization of undo logs etc. we can call buf_LRU_get_free_block() which can do an os_event_set(buf_flush_event). I think it is best to initialize the event in buf_pool_init().

2) When recovery is happening we have a separate background thread called recv_writer_thread which also does LRU tail cleaning. It makes sense to have this wake-up logic for recovery thread as well. 

3) In buf_LRU_get_free_block() we currently signal page_cleaner thread if we have iterated over the LRU list twice. It makes more sense to signal the page_cleaner the first time around when a thread tries to find a victim in LRU and is unable to find one.

How to repeat:
see description.

Suggested fix:
see reasoning in description. I'll also upload a small patch that fixes these issues.
[4 Nov 2013 17:31] Inaam Rana
Patch to fix the three issues described in the report

Attachment: 70811_5.7.patch (application/octet-stream, text), 1.91 KiB.

[6 Nov 2013 12:16] MySQL Verification Team
Thank you for the bug report and contribution.
[6 Nov 2013 20:10] Sunny Bains
#1 was already fixed, #2 and #3 seem more like enhancement requests and will look into them.