Commit 0f9bfcc3 authored by Vlad Lesin's avatar Vlad Lesin

MDEV-22554: "mariabackup --prepare" exits with code 0 even though innodb

error is logged

The fix is to set flag in ib::error::~error() and check it in
mariabackup.

ib::error::error() is replaced with ib::warn::warn() in
AIO::linux_create_io_ctx() because of two reasons:

1) if we leave it as is, then mariabackup MTR tests will fail with --mem
option, because Linux AIO can not be used on tmpfs,

2) when Linux AIO can not be initialized, InnoDB falls back to simulated
AIO, so such sutiation is not fatal error, it should be treated as warning.
parent a8406056
...@@ -5770,7 +5770,7 @@ static bool xtrabackup_prepare_func(char** argv) ...@@ -5770,7 +5770,7 @@ static bool xtrabackup_prepare_func(char** argv)
error_cleanup: error_cleanup:
xb_filters_free(); xb_filters_free();
return ok; return ok && !ib::error::was_logged();
} }
/************************************************************************** /**************************************************************************
......
...@@ -464,6 +464,14 @@ class error : public logger { ...@@ -464,6 +464,14 @@ class error : public logger {
public: public:
ATTRIBUTE_COLD ATTRIBUTE_COLD
~error(); ~error();
/** Indicates that error::~error() was invoked. Can be used to
determine if error messages were logged during innodb code execution.
@return true if there were error messages, false otherwise. */
static bool was_logged() { return logged; }
private:
/** true if error::~error() was invoked, false otherwise */
static bool logged;
}; };
/** The class fatal is used to emit an error message and stop the server /** The class fatal is used to emit an error message and stop the server
......
...@@ -2238,14 +2238,14 @@ AIO::linux_create_io_ctx( ...@@ -2238,14 +2238,14 @@ AIO::linux_create_io_ctx(
} }
/* Have tried enough. Better call it a day. */ /* Have tried enough. Better call it a day. */
ib::error() ib::warn()
<< "io_setup() failed with EAGAIN after " << "io_setup() failed with EAGAIN after "
<< OS_AIO_IO_SETUP_RETRY_ATTEMPTS << OS_AIO_IO_SETUP_RETRY_ATTEMPTS
<< " attempts."; << " attempts.";
break; break;
case -ENOSYS: case -ENOSYS:
ib::error() ib::warn()
<< "Linux Native AIO interface" << "Linux Native AIO interface"
" is not supported on this platform. Please" " is not supported on this platform. Please"
" check your OS documentation and install" " check your OS documentation and install"
...@@ -2254,7 +2254,7 @@ AIO::linux_create_io_ctx( ...@@ -2254,7 +2254,7 @@ AIO::linux_create_io_ctx(
break; break;
default: default:
ib::error() ib::warn()
<< "Linux Native AIO setup" << "Linux Native AIO setup"
<< " returned following error[" << " returned following error["
<< ret << "]"; << ret << "]";
......
...@@ -624,9 +624,13 @@ warn::~warn() ...@@ -624,9 +624,13 @@ warn::~warn()
sql_print_warning("InnoDB: %s", m_oss.str().c_str()); sql_print_warning("InnoDB: %s", m_oss.str().c_str());
} }
/** true if error::~error() was invoked, false otherwise */
bool error::logged;
error::~error() error::~error()
{ {
sql_print_error("InnoDB: %s", m_oss.str().c_str()); sql_print_error("InnoDB: %s", m_oss.str().c_str());
logged = true;
} }
#ifdef _MSC_VER #ifdef _MSC_VER
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment