summaryrefslogtreecommitdiff
path: root/sql/log.cc
diff options
context:
space:
mode:
authorSujatha <sujatha.sivakumar@mariadb.com>2020-05-19 11:22:39 +0530
committerSujatha <sujatha.sivakumar@mariadb.com>2020-05-20 17:42:28 +0530
commit836d70899780f28ea2a6870428ff6daac21ca993 (patch)
tree477a80fc79b96bcdf5961129c0de7dd6a7a4edea /sql/log.cc
parenta6b4d4beff4da53b7b8922a175b0119eda69bf5f (diff)
downloadmariadb-git-836d70899780f28ea2a6870428ff6daac21ca993.tar.gz
MDEV-22451: SIGSEGV in __memmove_avx_unaligned_erms/memcpy from _my_b_write on CREATE after RESET MASTER
Analysis: ======== RESET MASTER TO # command deletes all binary log files listed in the index file, resets the binary log index file to be empty, and creates a new binary log with number #. When the user provided binary log number is greater than the max allowed value '2147483647' server fails to generate a new binary log. The RESET MASTER statement marks the binlog closure status as 'LOG_CLOSE_TO_BE_OPENED' and exits. Statements which follow RESET MASTER try to write to binary log they find the log_state != LOG_CLOSED and proceed to write to binary log cache and it results in crash. Fix: === During MYSQL_BIN_LOG open, if generation of new binary log name fails then the "log_state" needs to be marked as "LOG_CLOSED". With this further statements will find binary log as closed and they will skip writing to the binary log.
Diffstat (limited to 'sql/log.cc')
-rw-r--r--sql/log.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/log.cc b/sql/log.cc
index 076dd36a219..9a5603f9ce7 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -3390,6 +3390,8 @@ bool MYSQL_BIN_LOG::open(const char *log_name,
log_type_arg, io_cache_type_arg))
{
sql_print_error("MYSQL_BIN_LOG::open failed to generate new file name.");
+ if (!is_relay_log)
+ goto err;
DBUG_RETURN(1);
}
@@ -3751,7 +3753,7 @@ err:
sql_print_error("Could not use %s for logging (error %d). \
Turning logging off for the whole duration of the MySQL server process. \
To turn it on again: fix the cause, \
-shutdown the MySQL server and restart it.", name, errno);
+shutdown the MySQL server and restart it.", (name) ? name : log_name, errno);
if (new_xid_list_entry)
delete new_xid_list_entry;
if (file >= 0)