MXS-1625 Move LOAD DATA sent statistics to QueryClassifier
Eventually the tracking will be internal to QueryClassifier.
This commit is contained in:
@ -63,6 +63,21 @@ public:
|
|||||||
m_load_data_state = state;
|
m_load_data_state = state;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t load_data_sent() const
|
||||||
|
{
|
||||||
|
return m_load_data_sent;
|
||||||
|
}
|
||||||
|
|
||||||
|
void append_load_data_sent(GWBUF* pBuffer)
|
||||||
|
{
|
||||||
|
m_load_data_sent += gwbuf_length(pBuffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void reset_load_data_sent()
|
||||||
|
{
|
||||||
|
m_load_data_sent = 0;
|
||||||
|
}
|
||||||
|
|
||||||
bool have_tmp_tables() const
|
bool have_tmp_tables() const
|
||||||
{
|
{
|
||||||
return m_have_tmp_tables;
|
return m_have_tmp_tables;
|
||||||
@ -120,7 +135,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
MXS_SESSION* m_pSession;
|
MXS_SESSION* m_pSession;
|
||||||
mxs_target_t m_use_sql_variables_in;
|
mxs_target_t m_use_sql_variables_in;
|
||||||
load_data_state_t m_load_data_state;
|
load_data_state_t m_load_data_state; /**< The LOAD DATA state */
|
||||||
|
uint64_t m_load_data_sent; /**< How much data has been sent */
|
||||||
bool m_have_tmp_tables;
|
bool m_have_tmp_tables;
|
||||||
bool m_large_query; /**< Set to true when processing payloads >= 2^24 bytes */
|
bool m_large_query; /**< Set to true when processing payloads >= 2^24 bytes */
|
||||||
bool m_multi_statements_allowed; /**< Are multi-statements allowed */
|
bool m_multi_statements_allowed; /**< Are multi-statements allowed */
|
||||||
|
|||||||
@ -202,6 +202,7 @@ QueryClassifier::QueryClassifier(MXS_SESSION* pSession,
|
|||||||
: m_pSession(pSession)
|
: m_pSession(pSession)
|
||||||
, m_use_sql_variables_in(use_sql_variables_in)
|
, m_use_sql_variables_in(use_sql_variables_in)
|
||||||
, m_load_data_state(LOAD_DATA_INACTIVE)
|
, m_load_data_state(LOAD_DATA_INACTIVE)
|
||||||
|
, m_load_data_sent(0)
|
||||||
, m_have_tmp_tables(false)
|
, m_have_tmp_tables(false)
|
||||||
, m_large_query(false)
|
, m_large_query(false)
|
||||||
, m_multi_statements_allowed(are_multi_statements_allowed(pSession))
|
, m_multi_statements_allowed(are_multi_statements_allowed(pSession))
|
||||||
|
|||||||
@ -146,7 +146,7 @@ log_transaction_status(RWSplitSession *rses, GWBUF *querybuf, uint32_t qtype)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
MXS_INFO("> Processing LOAD DATA LOCAL INFILE: %lu bytes sent.",
|
MXS_INFO("> Processing LOAD DATA LOCAL INFILE: %lu bytes sent.",
|
||||||
rses->m_load_data_sent);
|
rses->qc().load_data_sent());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -493,7 +493,7 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
|
|||||||
*/
|
*/
|
||||||
if (rses->qc().load_data_state() == QueryClassifier::LOAD_DATA_ACTIVE)
|
if (rses->qc().load_data_state() == QueryClassifier::LOAD_DATA_ACTIVE)
|
||||||
{
|
{
|
||||||
rses->m_load_data_sent += gwbuf_length(querybuf);
|
rses->qc().append_load_data_sent(querybuf);
|
||||||
}
|
}
|
||||||
else if (is_packet_a_query(packet_type))
|
else if (is_packet_a_query(packet_type))
|
||||||
{
|
{
|
||||||
@ -501,7 +501,7 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
|
|||||||
if (queryop == QUERY_OP_LOAD)
|
if (queryop == QUERY_OP_LOAD)
|
||||||
{
|
{
|
||||||
rses->qc().set_load_data_state(QueryClassifier::LOAD_DATA_START);
|
rses->qc().set_load_data_state(QueryClassifier::LOAD_DATA_START);
|
||||||
rses->m_load_data_sent = 0;
|
rses->qc().reset_load_data_sent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -597,8 +597,9 @@ route_target_t get_target_type(RWSplitSession *rses, GWBUF *buffer,
|
|||||||
{
|
{
|
||||||
/** Empty packet signals end of LOAD DATA LOCAL INFILE, send it to master*/
|
/** Empty packet signals end of LOAD DATA LOCAL INFILE, send it to master*/
|
||||||
rses->qc().set_load_data_state(QueryClassifier::LOAD_DATA_END);
|
rses->qc().set_load_data_state(QueryClassifier::LOAD_DATA_END);
|
||||||
|
rses->qc().append_load_data_sent(buffer);
|
||||||
MXS_INFO("> LOAD DATA LOCAL INFILE finished: %lu bytes sent.",
|
MXS_INFO("> LOAD DATA LOCAL INFILE finished: %lu bytes sent.",
|
||||||
rses->m_load_data_sent + gwbuf_length(buffer));
|
rses->qc().load_data_sent());
|
||||||
}
|
}
|
||||||
|
|
||||||
return route_target;
|
return route_target;
|
||||||
|
|||||||
@ -26,7 +26,6 @@ RWSplitSession::RWSplitSession(RWSplit* instance, MXS_SESSION* session,
|
|||||||
m_current_master(master),
|
m_current_master(master),
|
||||||
m_config(instance->config()),
|
m_config(instance->config()),
|
||||||
m_nbackends(instance->service()->n_dbref),
|
m_nbackends(instance->service()->n_dbref),
|
||||||
m_load_data_sent(0),
|
|
||||||
m_client(session->client_dcb),
|
m_client(session->client_dcb),
|
||||||
m_sescmd_count(1), // Needs to be a positive number to work
|
m_sescmd_count(1), // Needs to be a positive number to work
|
||||||
m_expected_responses(0),
|
m_expected_responses(0),
|
||||||
|
|||||||
@ -106,7 +106,6 @@ public:
|
|||||||
mxs::SRWBackend m_prev_target; /**< The previous target where a query was sent */
|
mxs::SRWBackend m_prev_target; /**< The previous target where a query was sent */
|
||||||
Config m_config; /**< copied config info from router instance */
|
Config m_config; /**< copied config info from router instance */
|
||||||
int m_nbackends; /**< Number of backend servers (obsolete) */
|
int m_nbackends; /**< Number of backend servers (obsolete) */
|
||||||
uint64_t m_load_data_sent; /**< How much data has been sent */
|
|
||||||
DCB* m_client; /**< The client DCB */
|
DCB* m_client; /**< The client DCB */
|
||||||
uint64_t m_sescmd_count; /**< Number of executed session commands */
|
uint64_t m_sescmd_count; /**< Number of executed session commands */
|
||||||
int m_expected_responses; /**< Number of expected responses to the current query */
|
int m_expected_responses; /**< Number of expected responses to the current query */
|
||||||
|
|||||||
Reference in New Issue
Block a user