-
Luis Soares authored
mode When the master was executing in sql_mode='traditional' (which implies that really_abort_on_warning returns TRUE - because of MODE_STRICT_ALL_TABLES), the error code (ER_DUP_ENTRY in the reported case) was not being set in the Query_log_event. Therefore, even if a failure was to be expected when replaying the statement on the slave, a failure would occur, because the Query_log_event was not transporting the expected error code, but 0 instead. This was because when the master was getting the error code to set it in the Query_log_event, the executing thread would be assumed to have been killed: THD::killed==THD::KILL_BAD_DATA. This would make the error code fetch routine not to check thd->main_da.sql_errno(), but instead the thd->killed value. What's more, is that the server would thd->killed value if thd->killed == THD::KILL_BAD_DATA and return 0 instead. So this is a double inconsistency, as the we should not even check thd->killed but rather thd->main_da.sql_errno(). We fix this by extending the condition used to choose whether to check the thd->main_da.sql_errno() or thd->killed, so that it takes into consideration the case when: thd->killed==THD::KILL_BAD_DATA.
7768ccbb