MXS-1507: Use same mechanism for all delayed routing
Passing the delay to the retry_query function allows the same function to be used in all cases. This removes duplicate code.
This commit is contained in:
@ -109,12 +109,12 @@ bool RWSplitSession::prepare_target(SRWBackend& target, route_target_t route_tar
|
|||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RWSplitSession::retry_query(GWBUF* querybuf)
|
void RWSplitSession::retry_query(GWBUF* querybuf, int delay)
|
||||||
{
|
{
|
||||||
ss_dassert(querybuf);
|
ss_dassert(querybuf);
|
||||||
// Try to route the query again later
|
// Try to route the query again later
|
||||||
MXS_SESSION* session = m_client->session;
|
MXS_SESSION* session = m_client->session;
|
||||||
session_delay_routing(session, router_as_downstream(session), querybuf, 1);
|
session_delay_routing(session, router_as_downstream(session), querybuf, delay);
|
||||||
++m_retry_duration;
|
++m_retry_duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,8 +641,7 @@ bool RWSplitSession::handle_error_new_connection(DCB *backend_dcb, GWBUF *errmsg
|
|||||||
if (stored && m_config.retry_failed_reads)
|
if (stored && m_config.retry_failed_reads)
|
||||||
{
|
{
|
||||||
MXS_INFO("Re-routing failed read after server '%s' failed", backend->name());
|
MXS_INFO("Re-routing failed read after server '%s' failed", backend->name());
|
||||||
MXS_SESSION* session = m_client->session;
|
retry_query(stored, 0);
|
||||||
session_delay_routing(session, router_as_downstream(session), stored, 0);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -163,7 +163,7 @@ private:
|
|||||||
bool handle_got_target(GWBUF* querybuf, mxs::SRWBackend& target, bool store);
|
bool handle_got_target(GWBUF* querybuf, mxs::SRWBackend& target, bool store);
|
||||||
void handle_connection_keepalive(mxs::SRWBackend& target);
|
void handle_connection_keepalive(mxs::SRWBackend& target);
|
||||||
bool prepare_target(mxs::SRWBackend& target, route_target_t route_target);
|
bool prepare_target(mxs::SRWBackend& target, route_target_t route_target);
|
||||||
void retry_query(GWBUF* querybuf);
|
void retry_query(GWBUF* querybuf, int delay = 1);
|
||||||
|
|
||||||
bool should_replace_master(mxs::SRWBackend& target);
|
bool should_replace_master(mxs::SRWBackend& target);
|
||||||
void replace_master(mxs::SRWBackend& target);
|
void replace_master(mxs::SRWBackend& target);
|
||||||
|
Reference in New Issue
Block a user