Bug #119457 import tablespace cost too long
Submitted: 25 Nov 9:00 Modified: 27 Nov 12:42
Reporter: yangyang wang Email Updates:
Status: Open Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S2 (Serious)
Version:5.7 OS:Any
Assigned to: CPU Architecture:Any

[25 Nov 9:00] yangyang wang
Description:
The import tablespace operation has completed flushing dirty pages to disk, but it still cannot finish for a long time. It is found that it is stuck at buf_flush_wait_flushed.

Phase III - Flush changes to disk
it has called buf_LRU_flush_or_remove_pages that flush all the space dirty pages

why need call buf_flush_wait_flushed in row_import_cleanup->log_make_checkpoint_at
->log_preflush_pool_modified_pages->buf_flush_wait_flushed

I noticed that the latest version of log_make_checkpoint_at has removed buf_flush_wait_flushed. Is this an optimization? Why was it needed earlier?

How to repeat:
Bufferpool size 98G, import tablespace concurrent read and write operations

Suggested fix:
The import_clean_up process does not require buf_flush_wait_flushed.
[27 Nov 12:42] yangyang wang
mysql8.0 will call log_wait_for_checkpoint now,
Why is it necessary to have checkpoints? Is it because we are concerned that after completing the import without checkpoints, there will be many business modifications in the space, and when the checkpoint is outdated, it could lead to slow crash recovery upon restart?