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:
Markus Mäkelä 2019-07-26 09:34:08 +03:00
parent 9a7153dcec
commit b07ffdb2fa
No known key found for this signature in database
GPG Key ID: 72D48FCE664F7B19

View File

@ -963,7 +963,9 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
MXS_INFO("Master '%s' failed: %s", backend->name(), extract_error(errmsgbuf).c_str());
/** 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
* failure as partial functionality still remains. If
@ -999,14 +1001,6 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
can_continue = true;
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)
@ -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->set_close_reason("Master connection failed: " + extract_error(errmsgbuf));
}