MXS-1625 Move tmp table state variable to mxs::QueryClassifier

This commit is contained in:
Johan Wikman
2018-04-04 11:48:46 +03:00
parent 8220c31664
commit bc22790e1b
6 changed files with 16 additions and 6 deletions

View File

@ -56,12 +56,23 @@ public:
m_load_data_state = state; m_load_data_state = state;
} }
bool have_tmp_tables() const
{
return m_have_tmp_tables;
}
void set_have_tmp_tables(bool have_tmp_tables)
{
m_have_tmp_tables = have_tmp_tables;
}
uint32_t get_route_target(uint8_t command, uint32_t qtype); uint32_t get_route_target(uint8_t command, uint32_t qtype);
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;
bool m_have_tmp_tables;
}; };
} }

View File

@ -23,6 +23,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_have_tmp_tables(false)
{ {
} }

View File

@ -229,7 +229,7 @@ void check_create_tmp_table(RWSplitSession *router_cli_ses,
ss_dassert(router_cli_ses && querybuf && router_cli_ses->m_client && ss_dassert(router_cli_ses && querybuf && router_cli_ses->m_client &&
router_cli_ses->m_client->data); router_cli_ses->m_client->data);
router_cli_ses->m_have_tmp_tables = true; router_cli_ses->qc().set_have_tmp_tables(true);
char* tblname = qc_get_created_table_name(querybuf); char* tblname = qc_get_created_table_name(querybuf);
std::string table; std::string table;
@ -505,7 +505,7 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
/** /**
* Check if the query has anything to do with temporary tables. * Check if the query has anything to do with temporary tables.
*/ */
if (rses->m_have_tmp_tables && is_packet_a_query(packet_type)) if (rses->qc().have_tmp_tables() && is_packet_a_query(packet_type))
{ {
check_drop_tmp_table(rses, querybuf); check_drop_tmp_table(rses, querybuf);
if (is_read_tmp_table(rses, querybuf, *qtype)) if (is_read_tmp_table(rses, querybuf, *qtype))

View File

@ -779,8 +779,8 @@ void RWSplitSession::replace_master(SRWBackend& target)
m_current_master = target; m_current_master = target;
// As the master has changed, we can reset the temporary table information // As the master has changed, we can reset the temporary table information
m_have_tmp_tables = false; m_qc.set_have_tmp_tables(false);
m_temp_tables.clear(); temp_tables.clear();
} }
/** /**

View File

@ -27,7 +27,6 @@ RWSplitSession::RWSplitSession(RWSplit* instance, MXS_SESSION* session,
m_large_query(false), m_large_query(false),
m_config(instance->config()), m_config(instance->config()),
m_nbackends(instance->service()->n_dbref), m_nbackends(instance->service()->n_dbref),
m_have_tmp_tables(false),
m_load_data_sent(0), 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

View File

@ -107,7 +107,6 @@ public:
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 */
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) */
bool m_have_tmp_tables; /**< True if temp tables have been created */
uint64_t m_load_data_sent; /**< How much data has been sent */ 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 */