-
Joao Gramacho authored
M_STATUS == DA_ERROR || M_STATUS == DA_OK Problem: ======= An assert will fail when the replication sql thread on a slave server is killed while waiting for commit lock will. Analysis: ======== In the case of a failed commit attempt at Xid_log_event::do_apply_event(), an error message will be reported informing the reason why the commit could not be completed. The error message to be reported is collected using message() at sql_error.h that contains an assert expecting that current m_status must be DA_ERROR or DA_OK before returning the message. The problem happens when the SQL thread is waiting for the commit lock at MDL_context::acquire_lock and is killed. In this case, the resulting wait_status will be MDL_wait::KILLED, and will result in acquire_lock() returning an error but without throwing one (both other cases, MDL_wait::VICTIM and MDL_wait::TIMEOUT, throw errors using my_error()). So, in the case of a thread being deliberate killed while waiting for a lock would lead to a case where no error was flagged, but also no success was flagged, making the assert expecting DA_ERROR or DA_OK to fail. Fix: === The code in MDL_context::acquire_lock in mysql-5.7 already throws an error for MDL_wait::KILLED. This patch just back-ported this behavior. Added also some debug sync points to easy putting sql thread in "Waiting for commit lock" state.
Joao Gramacho authoredM_STATUS == DA_ERROR || M_STATUS == DA_OK Problem: ======= An assert will fail when the replication sql thread on a slave server is killed while waiting for commit lock will. Analysis: ======== In the case of a failed commit attempt at Xid_log_event::do_apply_event(), an error message will be reported informing the reason why the commit could not be completed. The error message to be reported is collected using message() at sql_error.h that contains an assert expecting that current m_status must be DA_ERROR or DA_OK before returning the message. The problem happens when the SQL thread is waiting for the commit lock at MDL_context::acquire_lock and is killed. In this case, the resulting wait_status will be MDL_wait::KILLED, and will result in acquire_lock() returning an error but without throwing one (both other cases, MDL_wait::VICTIM and MDL_wait::TIMEOUT, throw errors using my_error()). So, in the case of a thread being deliberate killed while waiting for a lock would lead to a case where no error was flagged, but also no success was flagged, making the assert expecting DA_ERROR or DA_OK to fail. Fix: === The code in MDL_context::acquire_lock in mysql-5.7 already throws an error for MDL_wait::KILLED. This patch just back-ported this behavior. Added also some debug sync points to easy putting sql thread in "Waiting for commit lock" state.
Loading