Fix hang on transaction replay
The expected response counter was not decremented if a transaction replay was started. This caused the connections to hang which in turn caused the failure of the mxs1507_trx_stress test case.
This commit is contained in:
@ -963,7 +963,9 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
|||||||
MXS_INFO("Master '%s' failed: %s", backend->name(), extract_error(errmsgbuf).c_str());
|
MXS_INFO("Master '%s' failed: %s", backend->name(), extract_error(errmsgbuf).c_str());
|
||||||
/** The connection to the master has failed */
|
/** The connection to the master has failed */
|
||||||
|
|
||||||
if (!backend->is_waiting_result())
|
bool expected_response = backend->is_waiting_result();
|
||||||
|
|
||||||
|
if (!expected_response)
|
||||||
{
|
{
|
||||||
/** The failure of a master is not considered a critical
|
/** The failure of a master is not considered a critical
|
||||||
* failure as partial functionality still remains. If
|
* failure as partial functionality still remains. If
|
||||||
@ -999,14 +1001,6 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
|||||||
can_continue = true;
|
can_continue = true;
|
||||||
send_readonly_error(m_client);
|
send_readonly_error(m_client);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decrement the expected response count only if we know we can continue the sesssion.
|
|
||||||
// This keeps the internal logic sound even if another query is routed before the session
|
|
||||||
// is closed.
|
|
||||||
if (can_continue)
|
|
||||||
{
|
|
||||||
m_expected_responses--;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (session_trx_is_active(session) && m_otrx_state == OTRX_INACTIVE)
|
if (session_trx_is_active(session) && m_otrx_state == OTRX_INACTIVE)
|
||||||
@ -1034,6 +1028,14 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Decrement the expected response count only if we know we can continue the sesssion.
|
||||||
|
// This keeps the internal logic sound even if another query is routed before the session
|
||||||
|
// is closed.
|
||||||
|
if (can_continue && expected_response)
|
||||||
|
{
|
||||||
|
m_expected_responses--;
|
||||||
|
}
|
||||||
|
|
||||||
backend->close();
|
backend->close();
|
||||||
backend->set_close_reason("Master connection failed: " + extract_error(errmsgbuf));
|
backend->set_close_reason("Master connection failed: " + extract_error(errmsgbuf));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user