MXS-1506: Remove redundant variables
Keeping track of the closed state of the session inside the router session itself is not needed as the MaxScale core should already do that. The skygw_chk_t variables are rather meaningless and are obsoleted by Valgrind/ASAN.
This commit is contained in:
@ -632,26 +632,22 @@ RWSplitSession* RWSplit::newSession(MXS_SESSION *session)
|
|||||||
*/
|
*/
|
||||||
void RWSplitSession::close()
|
void RWSplitSession::close()
|
||||||
{
|
{
|
||||||
if (!rses_closed)
|
close_all_connections(backends);
|
||||||
|
|
||||||
|
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO) &&
|
||||||
|
sescmd_list.size())
|
||||||
{
|
{
|
||||||
rses_closed = true;
|
std::string sescmdstr;
|
||||||
close_all_connections(backends);
|
|
||||||
|
|
||||||
if (MXS_LOG_PRIORITY_IS_ENABLED(LOG_INFO) &&
|
for (mxs::SessionCommandList::iterator it = sescmd_list.begin();
|
||||||
sescmd_list.size())
|
it != sescmd_list.end(); it++)
|
||||||
{
|
{
|
||||||
std::string sescmdstr;
|
mxs::SSessionCommand& scmd = *it;
|
||||||
|
sescmdstr += scmd->to_string();
|
||||||
for (mxs::SessionCommandList::iterator it = sescmd_list.begin();
|
sescmdstr += "\n";
|
||||||
it != sescmd_list.end(); it++)
|
|
||||||
{
|
|
||||||
mxs::SSessionCommand& scmd = *it;
|
|
||||||
sescmdstr += scmd->to_string();
|
|
||||||
sescmdstr += "\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
MXS_INFO("Executed session commands:\n%s", sescmdstr.c_str());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MXS_INFO("Executed session commands:\n%s", sescmdstr.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -659,45 +655,38 @@ int32_t RWSplitSession::routeQuery(GWBUF* querybuf)
|
|||||||
{
|
{
|
||||||
int rval = 0;
|
int rval = 0;
|
||||||
|
|
||||||
if (rses_closed)
|
if (query_queue == NULL &&
|
||||||
|
(expected_responses == 0 ||
|
||||||
|
mxs_mysql_get_command(querybuf) == MXS_COM_STMT_FETCH ||
|
||||||
|
load_data_state == LOAD_DATA_ACTIVE ||
|
||||||
|
large_query))
|
||||||
{
|
{
|
||||||
closed_session_reply(querybuf);
|
/** Gather the information required to make routing decisions */
|
||||||
|
RouteInfo info(this, querybuf);
|
||||||
|
|
||||||
|
/** No active or pending queries */
|
||||||
|
if (route_single_stmt(querybuf, info))
|
||||||
|
{
|
||||||
|
rval = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (query_queue == NULL &&
|
/**
|
||||||
(expected_responses == 0 ||
|
* We are already processing a request from the client. Store the
|
||||||
mxs_mysql_get_command(querybuf) == MXS_COM_STMT_FETCH ||
|
* new query and wait for the previous one to complete.
|
||||||
load_data_state == LOAD_DATA_ACTIVE ||
|
*/
|
||||||
large_query))
|
ss_dassert(expected_responses || query_queue);
|
||||||
{
|
MXS_INFO("Storing query (len: %d cmd: %0x), expecting %d replies to current command",
|
||||||
/** Gather the information required to make routing decisions */
|
gwbuf_length(querybuf), GWBUF_DATA(querybuf)[4], expected_responses);
|
||||||
RouteInfo info(this, querybuf);
|
query_queue = gwbuf_append(query_queue, querybuf);
|
||||||
|
querybuf = NULL;
|
||||||
|
rval = 1;
|
||||||
|
ss_dassert(expected_responses > 0);
|
||||||
|
|
||||||
/** No active or pending queries */
|
if (expected_responses == 0 && !route_stored_query())
|
||||||
if (route_single_stmt(querybuf, info))
|
|
||||||
{
|
|
||||||
rval = 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/**
|
rval = 0;
|
||||||
* We are already processing a request from the client. Store the
|
|
||||||
* new query and wait for the previous one to complete.
|
|
||||||
*/
|
|
||||||
ss_dassert(expected_responses || query_queue);
|
|
||||||
MXS_INFO("Storing query (len: %d cmd: %0x), expecting %d replies to current command",
|
|
||||||
gwbuf_length(querybuf), GWBUF_DATA(querybuf)[4], expected_responses);
|
|
||||||
query_queue = gwbuf_append(query_queue, querybuf);
|
|
||||||
querybuf = NULL;
|
|
||||||
rval = 1;
|
|
||||||
ss_dassert(expected_responses > 0);
|
|
||||||
|
|
||||||
if (expected_responses == 0 && !route_stored_query())
|
|
||||||
{
|
|
||||||
rval = 0;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -913,7 +902,6 @@ void RWSplitSession::correct_packet_sequence(GWBUF *buffer)
|
|||||||
void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb)
|
void RWSplitSession::clientReply(GWBUF *writebuf, DCB *backend_dcb)
|
||||||
{
|
{
|
||||||
DCB *client_dcb = backend_dcb->session->client_dcb;
|
DCB *client_dcb = backend_dcb->session->client_dcb;
|
||||||
ss_dassert(!rses_closed);
|
|
||||||
|
|
||||||
SRWBackend& backend = get_backend_from_dcb(backend_dcb);
|
SRWBackend& backend = get_backend_from_dcb(backend_dcb);
|
||||||
|
|
||||||
@ -1026,13 +1014,6 @@ void RWSplitSession::handleError(GWBUF *errmsgbuf, DCB *problem_dcb,
|
|||||||
{
|
{
|
||||||
ss_dassert(problem_dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
ss_dassert(problem_dcb->dcb_role == DCB_ROLE_BACKEND_HANDLER);
|
||||||
CHK_DCB(problem_dcb);
|
CHK_DCB(problem_dcb);
|
||||||
|
|
||||||
if (rses_closed)
|
|
||||||
{
|
|
||||||
*succp = false;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
MXS_SESSION *session = problem_dcb->session;
|
MXS_SESSION *session = problem_dcb->session;
|
||||||
ss_dassert(session);
|
ss_dassert(session);
|
||||||
|
|
||||||
|
@ -22,8 +22,6 @@ RWSplitSession::RWSplitSession(RWSplit* instance, MXS_SESSION* session,
|
|||||||
const SRWBackendList& backends,
|
const SRWBackendList& backends,
|
||||||
const SRWBackend& master):
|
const SRWBackend& master):
|
||||||
mxs::RouterSession(session),
|
mxs::RouterSession(session),
|
||||||
rses_chk_top(CHK_NUM_ROUTER_SES),
|
|
||||||
rses_closed(false),
|
|
||||||
backends(backends),
|
backends(backends),
|
||||||
current_master(master),
|
current_master(master),
|
||||||
large_query(false),
|
large_query(false),
|
||||||
@ -41,8 +39,7 @@ RWSplitSession::RWSplitSession(RWSplit* instance, MXS_SESSION* session,
|
|||||||
recv_sescmd(0),
|
recv_sescmd(0),
|
||||||
gtid_pos(""),
|
gtid_pos(""),
|
||||||
wait_gtid_state(EXPECTING_NOTHING),
|
wait_gtid_state(EXPECTING_NOTHING),
|
||||||
next_seq(0),
|
next_seq(0)
|
||||||
rses_chk_tail(CHK_NUM_ROUTER_SES)
|
|
||||||
{
|
{
|
||||||
if (rses_config.rw_max_slave_conn_percent)
|
if (rses_config.rw_max_slave_conn_percent)
|
||||||
{
|
{
|
||||||
|
@ -94,8 +94,6 @@ public:
|
|||||||
bool* pSuccess);
|
bool* pSuccess);
|
||||||
|
|
||||||
// TODO: Make member variables private
|
// TODO: Make member variables private
|
||||||
skygw_chk_t rses_chk_top;
|
|
||||||
bool rses_closed; /**< true when closeSession is called */
|
|
||||||
mxs::SRWBackendList backends; /**< List of backend servers */
|
mxs::SRWBackendList backends; /**< List of backend servers */
|
||||||
mxs::SRWBackend current_master; /**< Current master server */
|
mxs::SRWBackend current_master; /**< Current master server */
|
||||||
mxs::SRWBackend target_node; /**< The currently locked target node */
|
mxs::SRWBackend target_node; /**< The currently locked target node */
|
||||||
@ -123,7 +121,6 @@ public:
|
|||||||
std::string gtid_pos; /**< Gtid position for causal read */
|
std::string gtid_pos; /**< Gtid position for causal read */
|
||||||
wait_gtid_state_t wait_gtid_state; /**< Determine boundray of wait gtid result and client query result */
|
wait_gtid_state_t wait_gtid_state; /**< Determine boundray of wait gtid result and client query result */
|
||||||
uint32_t next_seq; /**< Next packet'ssequence number */
|
uint32_t next_seq; /**< Next packet'ssequence number */
|
||||||
skygw_chk_t rses_chk_tail;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RWSplitSession(RWSplit* instance, MXS_SESSION* session,
|
RWSplitSession(RWSplit* instance, MXS_SESSION* session,
|
||||||
|
Reference in New Issue
Block a user