MXS-1549: Always store previous target

Unconditionally update the previous target on each routed query. This
allows routing to the previous server in case it is needed. One example of
this is a new type of hint that allows routing to the same server where
the previous query was sent.

Also added a minor clarifying comment to the resetting of the
current_query.
This commit is contained in:
Markus Mäkelä
2018-06-24 10:30:23 +03:00
parent a417567a18
commit d6a964304b
2 changed files with 5 additions and 10 deletions

View File

@ -1054,16 +1054,8 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
m_qc.set_large_query(large_query);
if (large_query)
{
/** Store the previous target as we're processing a multi-packet query */
m_prev_target = target;
}
else
{
/** Otherwise reset it so we know the query is complete */
m_prev_target.reset();
}
// Store the current target
m_prev_target = target;
/**
* If a READ ONLY transaction is ending set forced_node to NULL

View File

@ -514,6 +514,9 @@ void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb)
}
else
{
/** Normal response, reset the currently active query. This is done before
* the whole response is complete to prevent it from being retried
* in case the connection breaks in the middle of a resultset. */
m_current_query.reset();
}