MDEV-8901: InnoDB: Punch hole is incorrecty done also to log files causing assertion and database corruption

Analysis: Problem is that punch hole does not know the actual page size
of the page and does the page belong to an data file or to a log file.

Fix: Pass down the file type and page size to os layer to be used
when trim is called. Also fix unsafe null pointer access to
actual write_size.
This commit is contained in:
Jan Lindström 2015-10-06 15:40:26 +03:00
commit 21adad000a
10 changed files with 118 additions and 86 deletions

View file

@ -199,6 +199,7 @@ ibool
pfs_os_aio_func(
/*============*/
ulint type, /*!< in: OS_FILE_READ or OS_FILE_WRITE */
ulint is_log, /*!< in: 1 is OS_FILE_LOG or 0 */
ulint mode, /*!< in: OS_AIO_NORMAL etc. I/O mode */
const char* name, /*!< in: name of the file or path as a
null-terminated string */
@ -207,6 +208,7 @@ pfs_os_aio_func(
to write */
os_offset_t offset, /*!< in: file offset where to read or write */
ulint n, /*!< in: number of bytes to read or write */
ulint page_size, /*!< in: page size in bytes */
fil_node_t* message1,/*!< in: message for the aio handler
(can be used to identify a completed
aio operation); ignored if mode is
@ -234,8 +236,8 @@ pfs_os_aio_func(
: PSI_FILE_READ,
src_file, src_line);
result = os_aio_func(type, mode, name, file, buf, offset,
n, message1, message2, write_size);
result = os_aio_func(type, is_log, mode, name, file, buf, offset,
n, page_size, message1, message2, write_size);
register_pfs_file_io_end(locker, n);