From e6a8a9a9afc39073bdf645c59a43dbd3b25f49f7 Mon Sep 17 00:00:00 2001 From: Vlad Lesin Date: Wed, 13 May 2020 14:32:12 +0300 Subject: MDEV-22398: mariabackup.innodb_xa_rollback fails on repeat Post-push fix: mariabackup finishes execution with error if there were error messages in innodb error log during backup preparing. --- extra/mariabackup/xtrabackup.cc | 2 +- storage/innobase/include/ut0ut.h | 8 ++++++++ storage/innobase/os/os0file.cc | 6 +++--- storage/innobase/ut/ut0ut.cc | 4 ++++ 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/extra/mariabackup/xtrabackup.cc b/extra/mariabackup/xtrabackup.cc index 040fbeb8f32..b1120ba29f7 100644 --- a/extra/mariabackup/xtrabackup.cc +++ b/extra/mariabackup/xtrabackup.cc @@ -5770,7 +5770,7 @@ static bool xtrabackup_prepare_func(char** argv) error_cleanup: xb_filters_free(); - return ok; + return ok && !ib::error::was_logged(); } /************************************************************************** diff --git a/storage/innobase/include/ut0ut.h b/storage/innobase/include/ut0ut.h index 000d8b6b379..741687c07d7 100644 --- a/storage/innobase/include/ut0ut.h +++ b/storage/innobase/include/ut0ut.h @@ -464,6 +464,14 @@ class error : public logger { public: ATTRIBUTE_COLD ~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 diff --git a/storage/innobase/os/os0file.cc b/storage/innobase/os/os0file.cc index f7061388cb8..e468b842ce2 100644 --- a/storage/innobase/os/os0file.cc +++ b/storage/innobase/os/os0file.cc @@ -2238,14 +2238,14 @@ AIO::linux_create_io_ctx( } /* Have tried enough. Better call it a day. */ - ib::error() + ib::warn() << "io_setup() failed with EAGAIN after " << OS_AIO_IO_SETUP_RETRY_ATTEMPTS << " attempts."; break; case -ENOSYS: - ib::error() + ib::warn() << "Linux Native AIO interface" " is not supported on this platform. Please" " check your OS documentation and install" @@ -2254,7 +2254,7 @@ AIO::linux_create_io_ctx( break; default: - ib::error() + ib::warn() << "Linux Native AIO setup" << " returned following error[" << ret << "]"; diff --git a/storage/innobase/ut/ut0ut.cc b/storage/innobase/ut/ut0ut.cc index 252f3a50ae1..94d55a1d9ed 100644 --- a/storage/innobase/ut/ut0ut.cc +++ b/storage/innobase/ut/ut0ut.cc @@ -624,9 +624,13 @@ warn::~warn() sql_print_warning("InnoDB: %s", m_oss.str().c_str()); } +/** true if error::~error() was invoked, false otherwise */ +bool error::logged = false; + error::~error() { sql_print_error("InnoDB: %s", m_oss.str().c_str()); + logged = true; } #ifdef _MSC_VER -- cgit v1.2.1