-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
…hes server In Log_event::read_log_event(), don't use IO_CACHE::error of the relay log's IO_CACHE to signal an error back to the caller. When reading the active relay log, this flag is also being used by the IO thread, and setting it can randomly cause the IO thread to wrongly detect IO error on writing and permanently disable the relay log. This was seen sporadically in test case rpl.rpl_from_mysql80. The read error set by the SQL thread in the IO_CACHE would be interpreted as a write error by the IO thread, which would cause it to throw a fatal error and close the relay log. And this would later cause CHANGE MASTER to try to purge a closed relay log, resulting in nullptr crash. Also fix another sporadic failure in rpl.rpl_from_mysql80 where the outout of MASTER_POS_WAIT() depended on timing of SQL and IO thread. Signed-off-by: Kristian Nielsen <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -916,7 +916,7 @@ int Log_event::read_log_event(IO_CACHE* file, String* packet, | |
DBUG_RETURN(0); | ||
} | ||
|
||
Log_event* Log_event::read_log_event(IO_CACHE* file, | ||
Log_event* Log_event::read_log_event(IO_CACHE* file, int *out_error, | ||
const Format_description_log_event *fdle, | ||
my_bool crc_check, | ||
my_bool print_errors) | ||
|
@@ -927,6 +927,7 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, | |
const char *error= 0; | ||
Log_event *res= 0; | ||
|
||
*out_error= 0; | ||
switch (read_log_event(file, &event, fdle, BINLOG_CHECKSUM_ALG_OFF)) | ||
{ | ||
case 0: | ||
|
@@ -976,14 +977,14 @@ Log_event* Log_event::read_log_event(IO_CACHE* file, | |
#endif | ||
|
||
/* | ||
The SQL slave thread will check if file->error<0 to know | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
andrelkin
Contributor
|
||
The SQL slave thread will check *out_error to know | ||
if there was an I/O error. Even if there is no "low-level" I/O errors | ||
with 'file', any of the high-level above errors is worrying | ||
enough to stop the SQL thread now ; as we are skipping the current event, | ||
going on with reading and successfully executing other events can | ||
only corrupt the slave's databases. So stop. | ||
*/ | ||
file->error= -1; | ||
This comment has been minimized.
Sorry, something went wrong.
andrelkin
Contributor
|
||
*out_error= 1; | ||
|
||
#ifndef MYSQL_CLIENT | ||
if (!print_errors) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7845,7 +7845,8 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) | |
MYSQL_BIN_LOG::open() will write the buffered description event. | ||
*/ | ||
old_pos= rli->event_relay_log_pos; | ||
if ((ev= Log_event::read_log_event(cur_log, | ||
int error; | ||
if ((ev= Log_event::read_log_event(cur_log, &error, | ||
rli->relay_log.description_event_for_exec, | ||
opt_slave_sql_verify_checksum))) | ||
|
||
|
@@ -7862,8 +7863,8 @@ static Log_event* next_event(rpl_group_info *rgi, ulonglong *event_size) | |
DBUG_RETURN(ev); | ||
} | ||
if (opt_reckless_slave) // For mysql-test | ||
cur_log->error = 0; | ||
This comment has been minimized.
Sorry, something went wrong.
andrelkin
Contributor
|
||
if (unlikely(cur_log->error < 0)) | ||
error = 0; | ||
if (unlikely(error)) | ||
{ | ||
errmsg = "slave SQL thread aborted because of I/O error"; | ||
if (hot_log) | ||
|
The old line hits at something..
Considering that the whole idea is to separate the write and read errors, could it be also possibly achieved with the sign of
file->error
?