InnoDB reports that it's going to wait for I/O but the I/O is async

Bug #1107539 reported by Sergei Glushchenko
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Low
Sergei Glushchenko
5.1
Invalid
Undecided
Unassigned
5.5
Fix Released
Low
Sergei Glushchenko
5.6
Fix Released
Low
Sergei Glushchenko

Bug Description

Description:
Credit for discovery goes to MariaDB developers.

buf_read_page_low() reads:

thd_wait_begin(NULL, THD_WAIT_DISKIO);
if (zip_size) {
     fil_io(...);
} else {
     fil_io(...);
}
thd_wait_end(NULL, THD_WAIT_DISKIO);

The problem is that fil_io might be async here, returning much sooner than the sync call would (buf_read_page_low() has the ibool sync arg for that). Thus the thread might get needlessly reassigned to another query while it should have proceeded with the current one.

Don't know if it's a real issue with a thread pool or just a minor code quality as I cannot test with the Oracle thread pool.

How to repeat:
Might be possible to concoct some benchmark with MySQL Enterprise Edition, which I don't have an access to.

Suggested fix:
Guard thd_wait_begin()/thd_wait_end() calls with an if (sync) check.

Tags: innodb

Related branches

Changed in percona-server:
assignee: nobody → Sergei Glushchenko (sergei.glushchenko)
status: Confirmed → Fix Committed
tags: added: innodb
Revision history for this message
Stewart Smith (stewart) wrote :

Is this fixed by the 55-tp branch?

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Yes.

Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Fixed in upstream 5.5.31 and 5.6.11.

5.5$ bzr log -r 4189
------------------------------------------------------------
revno: 4189
committer: Inaam Rana <email address hidden>
branch nick: mysql-5.5
timestamp: Fri 2013-02-01 09:47:16 -0500
message:
  Bug#16249505 INNODB REPORTS THAT IT'S GOING TO WAIT FOR I/O BUT THE
  I/O IS ASYNC

  rb://1934
  approved by: Mikael Ronstrom (over email)

  When submitting AIO read request don't signal that the thread is
  about to wait on DISKIO

4701 in 5.6.

Revision history for this message
Shahriyar Rzayev (rzayev-sehriyar) wrote :

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-1964

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.