diff --git a/include/maxscale/queryclassifier.hh b/include/maxscale/queryclassifier.hh index 3da16b60b..c65f13238 100644 --- a/include/maxscale/queryclassifier.hh +++ b/include/maxscale/queryclassifier.hh @@ -66,6 +66,16 @@ public: m_have_tmp_tables = have_tmp_tables; } + bool large_query() const + { + return m_large_query; + } + + void set_large_query(bool large_query) + { + m_large_query = large_query; + } + uint32_t get_route_target(uint8_t command, uint32_t qtype); private: @@ -73,6 +83,7 @@ private: mxs_target_t m_use_sql_variables_in; load_data_state_t m_load_data_state; bool m_have_tmp_tables; + bool m_large_query; /**< Set to true when processing payloads >= 2^24 bytes */ }; } diff --git a/server/core/queryclassifier.cc b/server/core/queryclassifier.cc index e7c6d0713..259e51fed 100644 --- a/server/core/queryclassifier.cc +++ b/server/core/queryclassifier.cc @@ -24,6 +24,7 @@ QueryClassifier::QueryClassifier(MXS_SESSION* pSession, , m_use_sql_variables_in(use_sql_variables_in) , m_load_data_state(LOAD_DATA_INACTIVE) , m_have_tmp_tables(false) + , m_large_query(false) { } diff --git a/server/modules/routing/readwritesplit/readwritesplit.cc b/server/modules/routing/readwritesplit/readwritesplit.cc index 31c1b7156..9c09f735c 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.cc +++ b/server/modules/routing/readwritesplit/readwritesplit.cc @@ -347,7 +347,7 @@ int32_t RWSplitSession::routeQuery(GWBUF* querybuf) (expected_responses == 0 || mxs_mysql_get_command(querybuf) == MXS_COM_STMT_FETCH || m_qc.load_data_state() == QueryClassifier::LOAD_DATA_ACTIVE || - large_query)) + m_qc.large_query())) { /** Gather the information required to make routing decisions */ RouteInfo info(this, querybuf); diff --git a/server/modules/routing/readwritesplit/routeinfo.cc b/server/modules/routing/readwritesplit/routeinfo.cc index 7280eeff3..cd02c2de8 100644 --- a/server/modules/routing/readwritesplit/routeinfo.cc +++ b/server/modules/routing/readwritesplit/routeinfo.cc @@ -108,7 +108,7 @@ route_target_t get_route_target(mxs::QueryClassifier& qc, void log_transaction_status(RWSplitSession *rses, GWBUF *querybuf, uint32_t qtype) { - if (rses->m_large_query) + if (rses->qc().large_query()) { MXS_INFO("> Processing large request with more than 2^24 bytes of data"); } diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 99073a49d..d3ff447a5 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -164,7 +164,7 @@ bool RWSplitSession::route_single_stmt(GWBUF *querybuf, const RouteInfo& info) { bool store_stmt = false; - if (m_large_query) + if (m_qc.large_query()) { /** We're processing a large query that's split across multiple packets. * Route it to the same backend where we routed the previous packet. */ @@ -975,7 +975,9 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, SRWBackend& target, bool } } - if ((this->m_large_query = large_query)) + m_qc.set_large_query(large_query); + + if (large_query) { /** Store the previous target as we're processing a multi-packet query */ m_prev_target = target; diff --git a/server/modules/routing/readwritesplit/rwsplitsession.cc b/server/modules/routing/readwritesplit/rwsplitsession.cc index 26606f059..bd5b9930a 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.cc +++ b/server/modules/routing/readwritesplit/rwsplitsession.cc @@ -24,7 +24,6 @@ RWSplitSession::RWSplitSession(RWSplit* instance, MXS_SESSION* session, mxs::RouterSession(session), m_backends(backends), m_current_master(master), - m_large_query(false), m_config(instance->config()), m_nbackends(instance->service()->n_dbref), m_load_data_sent(0), diff --git a/server/modules/routing/readwritesplit/rwsplitsession.hh b/server/modules/routing/readwritesplit/rwsplitsession.hh index fb29cf806..9b95d4e89 100644 --- a/server/modules/routing/readwritesplit/rwsplitsession.hh +++ b/server/modules/routing/readwritesplit/rwsplitsession.hh @@ -104,7 +104,6 @@ public: mxs::SRWBackend m_current_master; /**< Current master server */ mxs::SRWBackend m_target_node; /**< The currently locked target node */ mxs::SRWBackend m_prev_target; /**< The previous target where a query was sent */ - bool m_large_query; /**< Set to true when processing payloads >= 2^24 bytes */ Config m_config; /**< copied config info from router instance */ int m_nbackends; /**< Number of backend servers (obsolete) */ uint64_t m_load_data_sent; /**< How much data has been sent */ @@ -175,7 +174,11 @@ private: */ inline bool locked_to_master() const { +<<<<<<< bc22790e1bde96fc6a16b8c719805b9d3dd193b5 return m_large_query || (m_current_master && m_target_node == m_current_master); +======= + return m_qc.large_query() || (current_master && target_node == current_master); +>>>>>>> MXS-1625 large_query flag moved from RWS session to query classifier } };