MXS-1506: Store queries inside RWSplitSession

As the readwritesplit is the only thing that uses the statement storage,
it can be integrated into RWSplitSession. This makes the code a lot
simpler.
This commit is contained in:
Markus Mäkelä
2018-04-04 17:35:07 +03:00
parent 53dec5323d
commit 450b31dd8c
5 changed files with 39 additions and 111 deletions

View File

@ -127,6 +127,7 @@ public:
uint32_t m_next_seq; /**< Next packet's sequence number */
mxs::QueryClassifier m_qc; /**< The query classifier. */
uint64_t m_retry_duration; /**< Total time spent retrying queries */
GWBUF* m_current_query; /**< Current query being executed, NULL for no query */
private:
RWSplitSession(RWSplit* instance, MXS_SESSION* session,
@ -191,6 +192,37 @@ private:
m_retry_duration < m_config.query_retry_timeout &&
!session_trx_is_active(m_client->session);
}
/**
* Set the current query
*
* @param query The current query
*/
inline void set_query(GWBUF* query)
{
ss_dassert(!m_current_query);
m_current_query = gwbuf_clone(query);
}
/**
* Release current query
*
* @return The current query
*/
inline GWBUF* release_query()
{
GWBUF* rval = m_current_query;
m_current_query = NULL;
return rval;
}
/**
* Reset current query
*/
inline void reset_query()
{
gwbuf_free(release_query());
}
};
/**