summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarko Mäkelä <marko.makela@mariadb.com>2022-11-30 10:54:03 +0200
committerMarko Mäkelä <marko.makela@mariadb.com>2022-11-30 10:54:03 +0200
commit15ab2e122da0ce17853a8f9fd0ac720701c8672a (patch)
treee35ba53359f472d1013b8152c606e0df455ac036
parentfc1403d3a9ef3230324396f621f72f02097c8a6a (diff)
downloadmariadb-git-15ab2e122da0ce17853a8f9fd0ac720701c8672a.tar.gz
MDEV-30132 Crash after recovery, with InnoDB: Tried to read ...
os_file_read(): Merged with os_file_read_no_error_handling(). Crashing on a partial page read is as unhelpful as crashing on a corrupted page read (commit 0b47c126e31cddda1e94588799599e138400bcf8). Report the file name if it is available via IORequest.
-rw-r--r--extra/mariabackup/backup_copy.cc4
-rw-r--r--extra/mariabackup/changed_page_bitmap.cc11
-rw-r--r--extra/mariabackup/fil_cur.cc4
-rw-r--r--extra/mariabackup/xtrabackup.cc9
-rw-r--r--storage/innobase/buf/buf0dblwr.cc8
-rw-r--r--storage/innobase/fil/fil0fil.cc4
-rw-r--r--storage/innobase/fsp/fsp0file.cc7
-rw-r--r--storage/innobase/include/os0file.h65
-rw-r--r--storage/innobase/include/os0file.inl46
-rw-r--r--storage/innobase/log/log0log.cc3
-rw-r--r--storage/innobase/os/os0file.cc121
-rw-r--r--storage/innobase/row/row0import.cc37
-rw-r--r--storage/innobase/row/row0log.cc12
-rw-r--r--storage/innobase/row/row0merge.cc12
-rw-r--r--storage/innobase/srv/srv0start.cc3
15 files changed, 92 insertions, 254 deletions
diff --git a/extra/mariabackup/backup_copy.cc b/extra/mariabackup/backup_copy.cc
index 9f322061ed3..a8959861926 100644
--- a/extra/mariabackup/backup_copy.cc
+++ b/extra/mariabackup/backup_copy.cc
@@ -561,8 +561,8 @@ datafile_read(datafile_cur_t *cursor)
}
if (os_file_read(IORequestRead,
- cursor->file, cursor->buf, cursor->buf_offset,
- to_read) != DB_SUCCESS) {
+ cursor->file, cursor->buf, cursor->buf_offset,
+ to_read, nullptr) != DB_SUCCESS) {
return(XB_FIL_CUR_ERROR);
}
diff --git a/extra/mariabackup/changed_page_bitmap.cc b/extra/mariabackup/changed_page_bitmap.cc
index 793d7378b0f..a6cc0e01492 100644
--- a/extra/mariabackup/changed_page_bitmap.cc
+++ b/extra/mariabackup/changed_page_bitmap.cc
@@ -188,18 +188,15 @@ log_online_read_bitmap_page(
{
ulint checksum;
ulint actual_checksum;
- ibool success;
ut_a(bitmap_file->size >= MODIFIED_PAGE_BLOCK_SIZE);
ut_a(bitmap_file->offset
<= bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE);
ut_a(bitmap_file->offset % MODIFIED_PAGE_BLOCK_SIZE == 0);
- success = os_file_read(IORequestRead,
- bitmap_file->file, page, bitmap_file->offset,
- MODIFIED_PAGE_BLOCK_SIZE) == DB_SUCCESS;
-
- if (UNIV_UNLIKELY(!success)) {
-
+ if (DB_SUCCESS !=
+ os_file_read(IORequestRead, bitmap_file->file, page,
+ bitmap_file->offset, MODIFIED_PAGE_BLOCK_SIZE,
+ nullptr)) {
/* The following call prints an error message */
os_file_get_last_error(TRUE);
msg("InnoDB: Warning: failed reading changed page bitmap "
diff --git a/extra/mariabackup/fil_cur.cc b/extra/mariabackup/fil_cur.cc
index 31afd39faf1..d7aca1362ed 100644
--- a/extra/mariabackup/fil_cur.cc
+++ b/extra/mariabackup/fil_cur.cc
@@ -223,7 +223,7 @@ xb_fil_cur_open(
if (!node->space->crypt_data
&& os_file_read(IORequestRead,
node->handle, cursor->buf, 0,
- cursor->page_size) == DB_SUCCESS) {
+ cursor->page_size, nullptr) == DB_SUCCESS) {
mysql_mutex_lock(&fil_system.mutex);
if (!node->space->crypt_data) {
node->space->crypt_data = fil_space_read_crypt_data(
@@ -415,7 +415,7 @@ read_retry:
cursor->buf_page_no = static_cast<unsigned>(offset / page_size);
if (os_file_read(IORequestRead, cursor->file, cursor->buf, offset,
- (ulint) to_read) != DB_SUCCESS) {
+ (ulint) to_read, nullptr) != DB_SUCCESS) {
ret = XB_FIL_CUR_ERROR;
goto func_exit;
}
diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc
index cd1d21cdf75..56973888457 100644
--- a/extra/mariabackup/xtrabackup.cc
+++ b/extra/mariabackup/xtrabackup.cc
@@ -3827,7 +3827,7 @@ static dberr_t xb_assign_undo_space_start()
byte* page = static_cast<byte*>
(aligned_malloc(srv_page_size, srv_page_size));
- if (os_file_read(IORequestRead, file, page, 0, srv_page_size)
+ if (os_file_read(IORequestRead, file, page, 0, srv_page_size, nullptr)
!= DB_SUCCESS) {
msg("Reading first page failed.\n");
error = DB_ERROR;
@@ -3839,7 +3839,7 @@ static dberr_t xb_assign_undo_space_start()
retry:
if (os_file_read(IORequestRead, file, page,
TRX_SYS_PAGE_NO << srv_page_size_shift,
- srv_page_size) != DB_SUCCESS) {
+ srv_page_size, nullptr) != DB_SUCCESS) {
msg("Reading TRX_SYS page failed.");
error = DB_ERROR;
goto func_exit;
@@ -5347,7 +5347,8 @@ xtrabackup_apply_delta(
offset = ((incremental_buffers * (page_size / 4))
<< page_size_shift);
if (os_file_read(IORequestRead, src_file,
- incremental_buffer, offset, page_size)
+ incremental_buffer, offset, page_size,
+ nullptr)
!= DB_SUCCESS) {
goto error;
}
@@ -5380,7 +5381,7 @@ xtrabackup_apply_delta(
/* read whole of the cluster */
if (os_file_read(IORequestRead, src_file,
incremental_buffer,
- offset, page_in_buffer * page_size)
+ offset, page_in_buffer * page_size, nullptr)
!= DB_SUCCESS) {
goto error;
}
diff --git a/storage/innobase/buf/buf0dblwr.cc b/storage/innobase/buf/buf0dblwr.cc
index b9f505db56e..c71fd8df068 100644
--- a/storage/innobase/buf/buf0dblwr.cc
+++ b/storage/innobase/buf/buf0dblwr.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2021, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -253,7 +253,7 @@ dberr_t buf_dblwr_t::init_or_load_pages(pfs_os_file_t file, const char *path)
/* Read the TRX_SYS header to check if we are using the doublewrite buffer */
dberr_t err= os_file_read(IORequestRead, file, read_buf,
TRX_SYS_PAGE_NO << srv_page_size_shift,
- srv_page_size);
+ srv_page_size, nullptr);
if (err != DB_SUCCESS)
{
@@ -285,7 +285,7 @@ func_exit:
/* Read the pages from the doublewrite buffer to memory */
err= os_file_read(IORequestRead, file, write_buf,
block1.page_no() << srv_page_size_shift,
- size << srv_page_size_shift);
+ size << srv_page_size_shift, nullptr);
if (err != DB_SUCCESS)
{
@@ -296,7 +296,7 @@ func_exit:
err= os_file_read(IORequestRead, file,
write_buf + (size << srv_page_size_shift),
block2.page_no() << srv_page_size_shift,
- size << srv_page_size_shift);
+ size << srv_page_size_shift, nullptr);
if (err != DB_SUCCESS)
{
ib::error() << "Failed to read the second double write buffer extent";
diff --git a/storage/innobase/fil/fil0fil.cc b/storage/innobase/fil/fil0fil.cc
index a81600f03ae..89af4e2420f 100644
--- a/storage/innobase/fil/fil0fil.cc
+++ b/storage/innobase/fil/fil0fil.cc
@@ -2750,10 +2750,6 @@ io_error:
buf, offset, len);
}
- /* We an try to recover the page from the double write buffer if
- the decompression fails or the page is corrupt. */
-
- ut_a(type.type == IORequest::DBLWR_RECOVER || err == DB_SUCCESS);
if (!type.is_async()) {
if (type.is_write()) {
release_sync_write:
diff --git a/storage/innobase/fsp/fsp0file.cc b/storage/innobase/fsp/fsp0file.cc
index d775fd9c657..bc709516b41 100644
--- a/storage/innobase/fsp/fsp0file.cc
+++ b/storage/innobase/fsp/fsp0file.cc
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2013, 2016, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2017, 2021, MariaDB Corporation.
+Copyright (c) 2017, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -263,12 +263,11 @@ Datafile::read_first_page(bool read_only_mode)
ulint n_read = 0;
- err = os_file_read_no_error_handling(
+ err = os_file_read(
IORequestReadPartial, m_handle, m_first_page, 0,
page_size, &n_read);
if (err == DB_SUCCESS) {
- ut_a(n_read == page_size);
break;
}
@@ -664,7 +663,7 @@ Datafile::find_space_id()
for (ulint j = 0; j < page_count; ++j) {
if (os_file_read(IORequestRead, m_handle, page,
- j * page_size, page_size)) {
+ j * page_size, page_size, nullptr)) {
ib::info()
<< "READ FAIL: page_no:" << j;
continue;
diff --git a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
index 40ffc4297ec..d64ad9feb87 100644
--- a/storage/innobase/include/os0file.h
+++ b/storage/innobase/include/os0file.h
@@ -582,12 +582,8 @@ The wrapper functions have the prefix of "innodb_". */
# define os_file_close(file) \
pfs_os_file_close_func(file, __FILE__, __LINE__)
-# define os_file_read(type, file, buf, offset, n) \
- pfs_os_file_read_func(type, file, buf, offset, n, __FILE__, __LINE__)
-
-# define os_file_read_no_error_handling(type, file, buf, offset, n, o) \
- pfs_os_file_read_no_error_handling_func( \
- type, file, buf, offset, n, o, __FILE__, __LINE__)
+# define os_file_read(type, file, buf, offset, n, o) \
+ pfs_os_file_read_func(type, file, buf, offset, n,o, __FILE__, __LINE__)
# define os_file_write(type, name, file, buf, offset, n) \
pfs_os_file_write_func(type, name, file, buf, offset, \
@@ -732,31 +728,6 @@ pfs_os_file_read_func(
void* buf,
os_offset_t offset,
ulint n,
- const char* src_file,
- uint src_line);
-
-/** NOTE! Please use the corresponding macro os_file_read_no_error_handling(),
-not directly this function!
-This is the performance schema instrumented wrapper function for
-os_file_read_no_error_handling_func() which requests a synchronous
-read operation.
-@param[in] type IO request context
-@param[in] file Open file handle
-@param[out] buf buffer where to read
-@param[in] offset file offset where to read
-@param[in] n number of bytes to read
-@param[out] o number of bytes actually read
-@param[in] src_file file name where func invoked
-@param[in] src_line line where the func invoked
-@return DB_SUCCESS if request was successful */
-UNIV_INLINE
-dberr_t
-pfs_os_file_read_no_error_handling_func(
- const IORequest& type,
- pfs_os_file_t file,
- void* buf,
- os_offset_t offset,
- ulint n,
ulint* o,
const char* src_file,
uint src_line);
@@ -882,11 +853,8 @@ to original un-instrumented file I/O APIs */
# define os_file_close(file) os_file_close_func(file)
-# define os_file_read(type, file, buf, offset, n) \
- os_file_read_func(type, file, buf, offset, n)
-
-# define os_file_read_no_error_handling(type, file, buf, offset, n, o) \
- os_file_read_no_error_handling_func(type, file, buf, offset, n, o)
+# define os_file_read(type, file, buf, offset, n, o) \
+ os_file_read_func(type, file, buf, offset, n, o)
# define os_file_write(type, name, file, buf, offset, n) \
os_file_write_func(type, name, file, buf, offset, n)
@@ -991,6 +959,7 @@ Requests a synchronous read operation.
@param[out] buf buffer where to read
@param[in] offset file offset where to read
@param[in] n number of bytes to read
+@param[out] o number of bytes actually read
@return DB_SUCCESS if request was successful */
dberr_t
os_file_read_func(
@@ -998,7 +967,8 @@ os_file_read_func(
os_file_t file,
void* buf,
os_offset_t offset,
- ulint n)
+ ulint n,
+ ulint* o)
MY_ATTRIBUTE((warn_unused_result));
/** Rewind file to its start, read at most size - 1 bytes from it to str, and
@@ -1013,27 +983,6 @@ os_file_read_string(
char* str,
ulint size);
-/** NOTE! Use the corresponding macro os_file_read_no_error_handling(),
-not directly this function!
-Requests a synchronous positioned read operation. This function does not do
-any error handling. In case of error it returns FALSE.
-@param[in] type IO request context
-@param[in] file Open file handle
-@param[out] buf buffer where to read
-@param[in] offset file offset where to read
-@param[in] n number of bytes to read
-@param[out] o number of bytes actually read
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_read_no_error_handling_func(
- const IORequest& type,
- os_file_t file,
- void* buf,
- os_offset_t offset,
- ulint n,
- ulint* o)
- MY_ATTRIBUTE((warn_unused_result));
-
/** NOTE! Use the corresponding macro os_file_write(), not directly this
function!
Requests a synchronous write operation.
diff --git a/storage/innobase/include/os0file.inl b/storage/innobase/include/os0file.inl
index e88f94b8ff3..7de3150540d 100644
--- a/storage/innobase/include/os0file.inl
+++ b/storage/innobase/include/os0file.inl
@@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 2010, 2017, Oracle and/or its affiliates. All Rights Reserved.
-Copyright (c) 2013, 2020, MariaDB Corporation.
+Copyright (c) 2013, 2022, MariaDB Corporation.
This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
@@ -210,6 +210,7 @@ os_file_read() which requests a synchronous read operation.
@param[out] buf buffer where to read
@param[in] offset file offset where to read
@param[in] n number of bytes to read
+@param[out] o number of bytes actually read
@param[in] src_file file name where func invoked
@param[in] src_line line where the func invoked
@return DB_SUCCESS if request was successful */
@@ -221,6 +222,7 @@ pfs_os_file_read_func(
void* buf,
os_offset_t offset,
ulint n,
+ ulint* o,
const char* src_file,
uint src_line)
{
@@ -232,47 +234,7 @@ pfs_os_file_read_func(
dberr_t result;
- result = os_file_read_func(type, file, buf, offset, n);
-
- register_pfs_file_io_end(locker, n);
-
- return(result);
-}
-
-/** NOTE! Please use the corresponding macro os_file_read_no_error_handling(),
-not directly this function!
-This is the performance schema instrumented wrapper function for
-os_file_read_no_error_handling_func() which requests a synchronous
-read operation.
-@param[in] type IO request context
-@param[in] file Open file handle
-@param[out] buf buffer where to read
-@param[in] offset file offset where to read
-@param[in] n number of bytes to read
-@param[out] o number of bytes actually read
-@param[in] src_file file name where func invoked
-@param[in] src_line line where the func invoked
-@return DB_SUCCESS if request was successful */
-UNIV_INLINE
-dberr_t
-pfs_os_file_read_no_error_handling_func(
- const IORequest& type,
- pfs_os_file_t file,
- void* buf,
- os_offset_t offset,
- ulint n,
- ulint* o,
- const char* src_file,
- uint src_line)
-{
- PSI_file_locker_state state;
- struct PSI_file_locker* locker = NULL;
-
- register_pfs_file_io_begin(
- &state, locker, file, n, PSI_FILE_READ, src_file, src_line);
-
- dberr_t result = os_file_read_no_error_handling_func(
- type, file, buf, offset, n, o);
+ result = os_file_read_func(type, file, buf, offset, n, o);
register_pfs_file_io_end(locker, n);
diff --git a/storage/innobase/log/log0log.cc b/storage/innobase/log/log0log.cc
index 6c888f9f58b..70f561280d9 100644
--- a/storage/innobase/log/log0log.cc
+++ b/storage/innobase/log/log0log.cc
@@ -275,7 +275,8 @@ dberr_t file_os_io::close() noexcept
dberr_t file_os_io::read(os_offset_t offset, span<byte> buf) noexcept
{
- return os_file_read(IORequestRead, m_fd, buf.data(), offset, buf.size());
+ return os_file_read(IORequestRead, m_fd, buf.data(), offset, buf.size(),
+ nullptr);
}
dberr_t file_os_io::write(const char *path, os_offset_t offset,
diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc
index dd8c4b0e171..c67d0b50217 100644
--- a/storage/innobase/os/os0file.cc
+++ b/storage/innobase/os/os0file.cc
@@ -36,6 +36,7 @@ Created 10/21/1995 Heikki Tuuri
#ifndef UNIV_INNOCHECKSUM
#include "os0file.h"
#include "sql_const.h"
+#include "log.h"
#ifdef __linux__
# include <sys/types.h>
@@ -177,7 +178,7 @@ mysql_pfs_key_t innodb_temp_file_key;
@param[in] should_abort whether to abort on an unknown error
@param[in] on_error_silent whether to suppress reports of non-fatal errors
@return true if we should retry the operation */
-static MY_ATTRIBUTE((warn_unused_result))
+static
bool
os_file_handle_error_cond_exit(
const char* name,
@@ -2768,15 +2769,14 @@ os_file_io(
bytes_returned += n_bytes;
if (type.type != IORequest::READ_MAYBE_PARTIAL) {
- const char* op = type.is_read()
- ? "read" : "written";
-
- ib::warn()
- << n
- << " bytes should have been " << op << ". Only "
- << bytes_returned
- << " bytes " << op << ". Retrying"
- << " for the remaining bytes.";
+ sql_print_warning("InnoDB: %zu bytes should have been"
+ " %s from %s, but got only %zd."
+ " Retrying.",
+ n, type.is_read()
+ ? "read" : "written",
+ type.node
+ ? type.node->name
+ : "(unknown file)", bytes_returned);
}
/* Advance the offset and buffer by n_bytes */
@@ -2917,52 +2917,38 @@ os_file_pread(
@param[in] offset file offset from the start where to read
@param[in] n number of bytes to read, starting from offset
@param[out] o number of bytes actually read
-@param[in] exit_on_err if true then exit on error
@return DB_SUCCESS or error code */
-static MY_ATTRIBUTE((warn_unused_result))
dberr_t
-os_file_read_page(
+os_file_read_func(
const IORequest& type,
os_file_t file,
void* buf,
os_offset_t offset,
ulint n,
- ulint* o,
- bool exit_on_err)
+ ulint* o)
{
- dberr_t err;
+ ut_ad(!type.node || type.node->handle == file);
+ ut_ad(n);
- os_bytes_read_since_printout += n;
+ os_bytes_read_since_printout+= n;
- ut_ad(n > 0);
+ dberr_t err;
+ ssize_t n_bytes= os_file_pread(type, file, buf, n, offset, &err);
- ssize_t n_bytes = os_file_pread(type, file, buf, n, offset, &err);
+ if (o)
+ *o= ulint(n_bytes);
- if (o) {
- *o = n_bytes;
- }
+ if (ulint(n_bytes) == n || err != DB_SUCCESS)
+ return err;
- if (ulint(n_bytes) == n || (err != DB_SUCCESS && !exit_on_err)) {
- return err;
- }
- int os_err = IF_WIN((int)GetLastError(), errno);
-
- if (!os_file_handle_error_cond_exit(
- NULL, "read", exit_on_err, false)) {
- ib::fatal()
- << "Tried to read " << n << " bytes at offset "
- << offset << ", but was only able to read " << n_bytes
- << ".Cannot read from file. OS error number "
- << os_err << ".";
- } else {
- ib::error() << "Tried to read " << n << " bytes at offset "
- << offset << ", but was only able to read " << n_bytes;
- }
- if (err == DB_SUCCESS) {
- err = DB_IO_ERROR;
- }
+ os_file_handle_error_cond_exit(type.node ? type.node->name : nullptr, "read",
+ false, false);
+ sql_print_error("InnoDB: Tried to read %zu bytes at offset %llu"
+ " of file %s, but was only able to read %zd",
+ n, offset, type.node ? type.node->name : "(unknown)",
+ n_bytes);
- return err;
+ return err ? err : DB_IO_ERROR;
}
/** Retrieves the last error number if an error occurs in a file io function.
@@ -3322,51 +3308,6 @@ os_file_truncate(
#endif /* _WIN32 */
}
-/** NOTE! Use the corresponding macro os_file_read(), not directly this
-function!
-Requests a synchronous positioned read operation.
-@return DB_SUCCESS if request was successful, DB_IO_ERROR on failure
-@param[in] type IO flags
-@param[in] file handle to an open file
-@param[out] buf buffer where to read
-@param[in] offset file offset from the start where to read
-@param[in] n number of bytes to read, starting from offset
-@return error code
-@retval DB_SUCCESS if the operation succeeded */
-dberr_t
-os_file_read_func(
- const IORequest& type,
- os_file_t file,
- void* buf,
- os_offset_t offset,
- ulint n)
-{
- return(os_file_read_page(type, file, buf, offset, n, NULL, true));
-}
-
-/** NOTE! Use the corresponding macro os_file_read_no_error_handling(),
-not directly this function!
-Requests a synchronous positioned read operation.
-@return DB_SUCCESS if request was successful, DB_IO_ERROR on failure
-@param[in] type IO flags
-@param[in] file handle to an open file
-@param[out] buf buffer where to read
-@param[in] offset file offset from the start where to read
-@param[in] n number of bytes to read, starting from offset
-@param[out] o number of bytes actually read
-@return DB_SUCCESS or error code */
-dberr_t
-os_file_read_no_error_handling_func(
- const IORequest& type,
- os_file_t file,
- void* buf,
- os_offset_t offset,
- ulint n,
- ulint* o)
-{
- return(os_file_read_page(type, file, buf, offset, n, o, false));
-}
-
/** Check the existence and type of the given file.
@param[in] path path name of file
@param[out] exists true if the file exists
@@ -3788,7 +3729,7 @@ dberr_t os_aio(const IORequest &type, void *buf, os_offset_t offset, size_t n)
if (!type.is_async()) {
err = type.is_read()
? os_file_read_func(type, type.node->handle,
- buf, offset, n)
+ buf, offset, n, nullptr)
: os_file_write_func(type, type.node->name,
type.node->handle,
buf, offset, n);
@@ -4149,10 +4090,10 @@ bool fil_node_t::read_page0()
if (!deferred)
{
page_t *page= static_cast<byte*>(aligned_malloc(psize, psize));
- if (os_file_read(IORequestRead, handle, page, 0, psize)
+ if (os_file_read(IORequestRead, handle, page, 0, psize, nullptr)
!= DB_SUCCESS)
{
- ib::error() << "Unable to read first page of file " << name;
+ sql_print_error("InnoDB: Unable to read first page of file %s", name);
corrupted:
aligned_free(page);
return false;
diff --git a/storage/innobase/row/row0import.cc b/storage/innobase/row/row0import.cc
index 9e336f267a3..590f9d73990 100644
--- a/storage/innobase/row/row0import.cc
+++ b/storage/innobase/row/row0import.cc
@@ -3101,9 +3101,8 @@ static dberr_t handle_instant_metadata(dict_table_t *table,
static_cast<byte *>(aligned_malloc(srv_page_size, srv_page_size)),
&aligned_free);
- if (dberr_t err= os_file_read_no_error_handling(IORequestReadPartial,
- file, first_page.get(), 0,
- srv_page_size, nullptr))
+ if (dberr_t err= os_file_read(IORequestReadPartial, file, first_page.get(),
+ 0, srv_page_size, nullptr))
return err;
auto space_flags= fsp_header_get_flags(first_page.get());
@@ -3141,7 +3140,7 @@ static dberr_t handle_instant_metadata(dict_table_t *table,
aligned_malloc(UNIV_PAGE_SIZE_MAX, UNIV_PAGE_SIZE_MAX)),
&aligned_free);
- if (dberr_t err= os_file_read_no_error_handling(
+ if (dberr_t err= os_file_read(
IORequestReadPartial, file, page.get(), 3 * physical_size,
physical_size, nullptr))
return err;
@@ -3198,10 +3197,8 @@ static dberr_t handle_instant_metadata(dict_table_t *table,
uint64_t child_page_no= btr_node_ptr_get_child_page_no(rec, offsets);
if (dberr_t err=
- os_file_read_no_error_handling(IORequestReadPartial, file,
- page.get(),
- child_page_no * physical_size,
- physical_size, nullptr))
+ os_file_read(IORequestReadPartial, file, page.get(),
+ child_page_no * physical_size, physical_size, nullptr))
return err;
if (dberr_t err= decrypt_decompress(space_crypt, space_flags,
@@ -3280,11 +3277,10 @@ static dberr_t handle_instant_metadata(dict_table_t *table,
&aligned_free);
if (dberr_t err=
- os_file_read_no_error_handling(IORequestReadPartial, file,
- second_page.get(), physical_size *
- mach_read_from_4(ptr +
- BTR_EXTERN_PAGE_NO),
- srv_page_size, nullptr))
+ os_file_read(IORequestReadPartial, file, second_page.get(),
+ physical_size *
+ mach_read_from_4(ptr + BTR_EXTERN_PAGE_NO),
+ physical_size, nullptr))
return err;
if (dberr_t err= decrypt_decompress(space_crypt, space_flags,
@@ -3696,8 +3692,8 @@ dberr_t FetchIndexRootPages::run(const fil_iterator_t& iter,
bool page_compressed= false;
- dberr_t err= os_file_read_no_error_handling(
- IORequestReadPartial, iter.file, readptr, 3 * size, size, 0);
+ dberr_t err= os_file_read(IORequestReadPartial, iter.file, readptr,
+ 3 * size, size, nullptr);
if (err != DB_SUCCESS)
{
ib::error() << iter.filepath << ": os_file_read() failed";
@@ -3821,9 +3817,8 @@ static dberr_t fil_iterate(
? iter.crypt_io_buffer : io_buffer;
byte* const writeptr = readptr;
- err = os_file_read_no_error_handling(
- IORequestReadPartial,
- iter.file, readptr, offset, n_bytes, 0);
+ err = os_file_read(IORequestReadPartial, iter.file, readptr,
+ offset, n_bytes, nullptr);
if (err != DB_SUCCESS) {
ib::error() << iter.filepath
<< ": os_file_read() failed";
@@ -4156,10 +4151,10 @@ fil_tablespace_iterate(
block->page.frame = page;
block->page.init(buf_page_t::UNFIXED + 1, page_id_t{~0ULL});
- /* Read the first page and determine the page and zip size. */
+ /* Read the first page and determine the page size. */
- err = os_file_read_no_error_handling(IORequestReadPartial,
- file, page, 0, srv_page_size, 0);
+ err = os_file_read(IORequestReadPartial, file, page, 0, srv_page_size,
+ nullptr);
if (err == DB_SUCCESS) {
err = callback.init(file_size, block);
diff --git a/storage/innobase/row/row0log.cc b/storage/innobase/row/row0log.cc
index 0689f9ca029..42e09ffd180 100644
--- a/storage/innobase/row/row0log.cc
+++ b/storage/innobase/row/row0log.cc
@@ -2600,9 +2600,9 @@ all_done:
byte* buf = index->online_log->head.block;
- if (os_file_read_no_error_handling(
- IORequestRead, index->online_log->fd,
- buf, ofs, srv_sort_buf_size, 0) != DB_SUCCESS) {
+ if (DB_SUCCESS
+ != os_file_read(IORequestRead, index->online_log->fd,
+ buf, ofs, srv_sort_buf_size, nullptr)) {
ib::error()
<< "Unable to read temporary file"
" for table " << index->table->name;
@@ -3520,9 +3520,9 @@ all_done:
byte* buf = index->online_log->head.block;
- if (os_file_read_no_error_handling(
- IORequestRead, index->online_log->fd,
- buf, ofs, srv_sort_buf_size, 0) != DB_SUCCESS) {
+ if (DB_SUCCESS
+ != os_file_read(IORequestRead, index->online_log->fd,
+ buf, ofs, srv_sort_buf_size, nullptr)) {
ib::error()
<< "Unable to read temporary file"
" for index " << index->name;
diff --git a/storage/innobase/row/row0merge.cc b/storage/innobase/row/row0merge.cc
index dba3c0a144a..8914021d09d 100644
--- a/storage/innobase/row/row0merge.cc
+++ b/storage/innobase/row/row0merge.cc
@@ -1087,11 +1087,11 @@ row_merge_read(
DBUG_LOG("ib_merge_sort", "fd=" << fd << " ofs=" << ofs);
DBUG_EXECUTE_IF("row_merge_read_failure", DBUG_RETURN(FALSE););
- const bool success = DB_SUCCESS == os_file_read_no_error_handling(
- IORequestRead, fd, buf, ofs, srv_sort_buf_size, 0);
+ const dberr_t err = os_file_read(
+ IORequestRead, fd, buf, ofs, srv_sort_buf_size, nullptr);
/* If encryption is enabled decrypt buffer */
- if (success && log_tmp_is_encrypted()) {
+ if (err == DB_SUCCESS && srv_encrypt_log) {
if (!log_tmp_block_decrypt(buf, srv_sort_buf_size,
crypt_buf, ofs)) {
DBUG_RETURN(false);
@@ -1106,11 +1106,7 @@ row_merge_read(
posix_fadvise(fd, ofs, srv_sort_buf_size, POSIX_FADV_DONTNEED);
#endif /* POSIX_FADV_DONTNEED */
- if (!success) {
- ib::error() << "Failed to read merge block at " << ofs;
- }
-
- DBUG_RETURN(success);
+ DBUG_RETURN(err == DB_SUCCESS);
}
/********************************************************************//**
diff --git a/storage/innobase/srv/srv0start.cc b/storage/innobase/srv/srv0start.cc
index 859492bc957..8b29af5c083 100644
--- a/storage/innobase/srv/srv0start.cc
+++ b/storage/innobase/srv/srv0start.cc
@@ -518,7 +518,8 @@ static ulint srv_undo_tablespace_open(bool create, const char* name, ulint i)
{
page_t *page= static_cast<byte*>(aligned_malloc(srv_page_size,
srv_page_size));
- dberr_t err= os_file_read(IORequestRead, fh, page, 0, srv_page_size);
+ dberr_t err= os_file_read(IORequestRead, fh, page, 0, srv_page_size,
+ nullptr);
if (err != DB_SUCCESS)
{
err_exit: