MXS-1506: Remove mxs::Buffer wrappers from RWSplitSession
Now that the mxs::Buffer has a copy_from for GWBUFs, there's no need to use wrapper functions. This removes the duplicate code in the wrappers.
This commit is contained in:
parent
23aa9cc492
commit
997835c7f8
@ -965,7 +965,7 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool
|
||||
{
|
||||
if (store)
|
||||
{
|
||||
set_query(querybuf);
|
||||
m_current_query.copy_from(querybuf);
|
||||
}
|
||||
|
||||
atomic_add_uint64(&m_router->stats().n_queries, 1);
|
||||
|
@ -92,7 +92,7 @@ void close_all_connections(SRWBackendList& backends)
|
||||
void RWSplitSession::close()
|
||||
{
|
||||
close_all_connections(m_backends);
|
||||
reset_query();
|
||||
m_current_query.reset();
|
||||
|
||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO) &&
|
||||
m_sescmd_list.size())
|
||||
@ -384,7 +384,7 @@ void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb)
|
||||
return;
|
||||
}
|
||||
|
||||
reset_query();
|
||||
m_current_query.reset();
|
||||
|
||||
if (backend->reply_is_complete(writebuf))
|
||||
{
|
||||
@ -511,7 +511,7 @@ void RWSplitSession::handleError(GWBUF *errmsgbuf, DCB *problem_dcb,
|
||||
if (can_retry_query())
|
||||
{
|
||||
can_continue = true;
|
||||
retry_query(release_query());
|
||||
retry_query(m_current_query.release());
|
||||
}
|
||||
else if (m_config.master_failure_mode == RW_ERROR_ON_WRITE)
|
||||
{
|
||||
@ -611,7 +611,7 @@ bool RWSplitSession::handle_error_new_connection(DCB *backend_dcb, GWBUF *errmsg
|
||||
* Try to reroute the statement to a working server or send an error
|
||||
* to the client.
|
||||
*/
|
||||
GWBUF *stored = release_query();
|
||||
GWBUF *stored = m_current_query.release();
|
||||
|
||||
if (stored && m_config.retry_failed_reads)
|
||||
{
|
||||
|
@ -194,35 +194,6 @@ private:
|
||||
m_retry_duration < m_config.delayed_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.get());
|
||||
m_current_query.reset(gwbuf_clone(query));
|
||||
}
|
||||
|
||||
/**
|
||||
* Release current query
|
||||
*
|
||||
* @return The current query
|
||||
*/
|
||||
inline GWBUF* release_query()
|
||||
{
|
||||
return m_current_query.release();
|
||||
}
|
||||
|
||||
/**
|
||||
* Reset current query
|
||||
*/
|
||||
inline void reset_query()
|
||||
{
|
||||
m_current_query.reset();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user