mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Bug#22725 Replication outages from ER_SERVER_SHUTDOWN (1053) set in replication events
The reason for the bug was that replaying of a query on slave could not be possible since its event was recorded with the killed error. Due to the specific of handling INSERT, which per-row-while-loop is unbreakable to killing, the query on transactional table should have not appeared in binlog unless there was a call to a stored routine that got interrupted with killing (and then there must be an error returned out of the loop). The offered solution added the following rule for binlogging of INSERT that accounts the above specifics: For INSERT on transactional-table if the error was not set the only raised flag is harmless and is ignored via masking out on time of creation of binlog event. For both table types the combination of raised error and KILLED flag indicates that there was potentially partial execution on master and consistency is under the question. In that case the code continues to binlog an event with an appropriate killed error. The fix relies on the specified behaviour of stored routine that must propagate the error to the top level query handling if the thd->killed flag was raised in the routine execution. The patch adds an arg with the default killed-status-unset value to Query_log_event::Query_log_event.
This commit is contained in:

parent
3b598218ff
commit
b8a5a770f0
@ -521,6 +521,37 @@ int mysql_update(THD *thd,
|
||||
table->file->unlock_row();
|
||||
thd->row_count++;
|
||||
}
|
||||
|
||||
/*
|
||||
todo bug#27571: to avoid asynchronization of `error' and
|
||||
`error_code' of binlog event constructor
|
||||
|
||||
The concept, which is a bit different for insert(!), is to
|
||||
replace `error' assignment with the following lines
|
||||
|
||||
killed_status= thd->killed; // get the status of the volatile
|
||||
|
||||
Notice: thd->killed is type of "state" whereas the lhs has
|
||||
"status" the suffix which translates according to WordNet: a state
|
||||
at a particular time - at the time of the end of per-row loop in
|
||||
our case. Binlogging ops are conducted with the status.
|
||||
|
||||
error= (killed_status == THD::NOT_KILLED)? error : 1;
|
||||
|
||||
which applies to most mysql_$query functions.
|
||||
Event's constructor will accept `killed_status' as an argument:
|
||||
|
||||
Query_log_event qinfo(..., killed_status);
|
||||
|
||||
thd->killed might be changed after killed_status had got cached and this
|
||||
won't affect binlogging event but other effects remain.
|
||||
|
||||
Open issue: In a case the error happened not because of KILLED -
|
||||
and then KILLED was caught later still within the loop - we shall
|
||||
do something to avoid binlogging of incorrect ER_SERVER_SHUTDOWN
|
||||
error_code.
|
||||
*/
|
||||
|
||||
if (thd->killed && !error)
|
||||
error= 1; // Aborted
|
||||
end_read_record(&info);
|
||||
|
Reference in New Issue
Block a user