ibd files contain bogus trailing zeros and non-page size file sizes

Bug #1262500 reported by Andrew Gaul
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Percona Server moved to https://jira.percona.com/projects/PS
Fix Released
Laurynas Biveinis
Fix Released
Laurynas Biveinis
Fix Released
Laurynas Biveinis
Fix Released
Laurynas Biveinis

Bug Description

os0file.cc:os_file_pwrite does not handle partial writes, a possible cause of bogus trailing zeroes and non-page size files sizes. I will attach a patch which addresses this. Note that MySQL 5.7 handles this, although limits NUM_RETRIES_ON_PARTIAL_IO to 10. Possibly related XtraBackup assertion errors:


Related branches

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

mysql-server$ bzr log -r 4334
revno: 4334
committer: Aditya A <email address hidden>
branch nick: mysql-trunk
timestamp: Mon 2012-08-27 10:57:55 +0530
                 NOT IMMEDIATELY PANIC
  (innodb should retry partial reads/writes where errno was 0)

  In the Linux flavours the read and write system calls can
  do partial reads and writes.

  The man page of read says that " The return value is
  is smaller than the number of bytes requested; this
  may happen for example because fewer bytes are actually
  available right now (maybe because we were close to
  end-of-file,or because we are reading from a pipe,
  or from a terminal), or because read() was interrupted by
  a signal."

  The Fix
  Initially InnoDB was not handling the partial read and
  writes.With this fix innodb tries NUM_RETRIES_ON_PARTIAL_IO
  (which by default is equal to 10)times to read or write the
  partial data .The fix also takes care of partial read and
  write in case of Linux native API's where read and write
  are asynyncronus operations.

  rb:1158 [approved by inaam.rana]

tags: added: contribution
Revision history for this message
Alexey Kopytov (akopytov) wrote :

Some notes:

1. Triggering partial reads/writes requires a rather exotic filesystem (so far we only have reports from configurations involving a distributed or network-based FS).

2. The patch appears to be correct, but addresses a rather uncommon code path for 5.5 and later versions, since it only fixes synchronous IO, whereas on MySQL 5.5 and later asynchronous IO is used by default.

So the problem with AIO calls in PS 5.5 / 5.6 still exists with fixes for both bugs. Therefore, I don't think this bug is related to bug #1177201. Due to above considerations, this bug is also certainly not High importance.

I have reported bug #1263087 to track the AIO part.

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

Thanks Alexey, indeed we have to fix bug 1263087 too, the MySQL 5.7 commit above addressed that.

Note that synchronous I/O in 5.5/5.6 is still quite common: all the data page reads except readahead are synchronous.

Revision history for this message
Andrew Gaul (gaul) wrote :

Thanks for opening issues for fsync and aio; reading through the #ifdef maze again I believe that bug #1263087 most plausibly addresses my symptoms. I hypothesize that file0fil.cc:fil_extend_space_to_desired_size extends an ibd past its intended size, triggering bug #1177201. I encountered these symptoms on Linux 3.8 using ext4 with LVM2 thinp. I did not previously encounter them on Linux 3.2 using ext4 without LVM.

Revision history for this message
Alexey Kopytov (akopytov) wrote :

The problem with reads is even more hypothetical. Unlike writes, a failed read would be detected immediately on page validation. In which case we would have a fair number of page corruption bug reports.

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-1460

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.