Replace the plain GWBUF query queue with std::deque

Using a std::deque to store the queries retains the exact state of the
object thus removing the need to parse the query again. It also removes
the need to split the queue into individual packets which makes the code
cleaner.
This commit is contained in:
Markus Mäkelä
2019-03-15 14:37:34 +02:00
parent 0001babd26
commit 5e3198f831
3 changed files with 26 additions and 24 deletions

View File

@ -16,6 +16,7 @@
#include "trx.hh"
#include <string>
#include <deque>
#include <maxscale/buffer.hh>
#include <maxscale/modutil.hh>
@ -269,7 +270,7 @@ private:
inline bool can_route_queries() const
{
return m_query_queue == NULL
return m_query_queue.empty()
&& (m_expected_responses == 0
|| m_qc.load_data_state() == mxs::QueryClassifier::LOAD_DATA_ACTIVE
|| m_qc.large_query());
@ -319,7 +320,7 @@ private:
uint64_t m_sescmd_count; /**< Number of executed session commands (starts from 1) */
int m_expected_responses; /**< Number of expected responses to the current
* query */
GWBUF* m_query_queue; /**< Queued commands waiting to be executed */
std::deque<GWBUF*> m_query_queue; /**< Queued commands waiting to be executed */
RWSplit* m_router; /**< The router instance */
mxs::SessionCommandList m_sescmd_list; /**< List of executed session commands */
ResponseMap m_sescmd_responses; /**< Response to each session command */