Commit ad17e8e5 authored by Vladislav Vaintroub's avatar Vladislav Vaintroub

MDEV-13821 : mariabackup sometimes could lose ib_logf(FATAL) messages,

The messages are getting lost because they are written with fprintf()
but without fflush(), so abort() would lose buffered text.

Applied fix from 10.2, which makes in_logf() use
sql_print_information(), which in turn does proper flush after each message
parent 93087d5f
......@@ -95,6 +95,7 @@ Place, Suite 330, Boston, MA 02111-1307 USA
#include <sql_plugin.h>
#include <srv0srv.h>
#include <crc_glue.h>
#include <log.h>
/* TODO: replace with appropriate macros used in InnoDB 5.6 */
#define PAGE_ZIP_MIN_SIZE_SHIFT 10
......@@ -6483,6 +6484,11 @@ int main(int argc, char **argv)
system_charset_info = &my_charset_utf8_general_ci;
key_map_full.set_all();
logger.init_base();
logger.set_handlers(LOG_FILE, LOG_NONE, LOG_NONE);
mysql_mutex_init(key_LOCK_error_log, &LOCK_error_log,
MY_MUTEX_INIT_FAST);
handle_options(argc, argv, &client_defaults, &server_defaults);
int argc_server;
......
......@@ -21949,27 +21949,21 @@ ib_logf(
str = static_cast<char*>(malloc(BUFSIZ));
my_vsnprintf(str, BUFSIZ, format, args);
#endif /* __WIN__ */
if (!IS_XTRABACKUP()) {
switch (level) {
case IB_LOG_LEVEL_INFO:
sql_print_information("InnoDB: %s", str);
break;
case IB_LOG_LEVEL_WARN:
sql_print_warning("InnoDB: %s", str);
break;
case IB_LOG_LEVEL_ERROR:
sql_print_error("InnoDB: %s", str);
sd_notifyf(0, "STATUS=InnoDB: Error: %s", str);
break;
case IB_LOG_LEVEL_FATAL:
sql_print_error("InnoDB: %s", str);
sd_notifyf(0, "STATUS=InnoDB: Fatal: %s", str);
break;
}
}
else {
/* Don't use server logger for XtraBackup, just print to stderr. */
fprintf(stderr, "InnoDB: %s\n", str);
switch (level) {
case IB_LOG_LEVEL_INFO:
sql_print_information("InnoDB: %s", str);
break;
case IB_LOG_LEVEL_WARN:
sql_print_warning("InnoDB: %s", str);
break;
case IB_LOG_LEVEL_ERROR:
sql_print_error("InnoDB: %s", str);
sd_notifyf(0, "STATUS=InnoDB: Error: %s", str);
break;
case IB_LOG_LEVEL_FATAL:
sql_print_error("InnoDB: %s", str);
sd_notifyf(0, "STATUS=InnoDB: Fatal: %s", str);
break;
}
va_end(args);
......
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