Fix readwritesplit response count assertion
The assertion in routeQuery that expects there to be at least one ongoing query would be triggered if a query was received after a master had failed but before the session would close. To make sure the internal logic stays consistent, the error handler should only decrement the expected response count if the session can continue.
This commit is contained in:
parent
f8ee11cf55
commit
84f4688ebb
@ -985,7 +985,6 @@ void RWSplitSession::handleError(GWBUF* errmsgbuf,
|
||||
{
|
||||
// We were expecting a response but we aren't going to get one
|
||||
mxb_assert(m_expected_responses > 0);
|
||||
m_expected_responses--;
|
||||
errmsg += " Lost connection to master server while waiting for a result.";
|
||||
|
||||
if (can_retry_query())
|
||||
@ -1000,6 +999,14 @@ 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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user