Merge branch '2.3' into develop
This commit is contained in:
@ -221,7 +221,7 @@ PRWBackends::iterator find_best_backend(PRWBackends& backends,
|
||||
bool masters_accepts_reads)
|
||||
{
|
||||
// Group backends by priority. The set of highest priority backends will then compete.
|
||||
int best_priority {INT_MAX}; // low numbers are high priority
|
||||
int best_priority {2}; // low numbers are high priority
|
||||
|
||||
for (auto& psBackend : backends)
|
||||
{
|
||||
@ -251,7 +251,12 @@ PRWBackends::iterator find_best_backend(PRWBackends& backends,
|
||||
}
|
||||
|
||||
auto best = select(priority_map[best_priority]);
|
||||
auto rval = std::find(backends.begin(), backends.end(), *best);
|
||||
auto rval = backends.end();
|
||||
|
||||
if (best != priority_map[best_priority].end())
|
||||
{
|
||||
rval = std::find(backends.begin(), backends.end(), *best);
|
||||
}
|
||||
|
||||
for (auto& a : priority_map)
|
||||
{
|
||||
|
@ -244,14 +244,17 @@ bool RWSplitSession::route_stored_query()
|
||||
GWBUF* temp_storage = m_query_queue;
|
||||
m_query_queue = NULL;
|
||||
|
||||
// The query needs to be explicitly parsed as it was processed multiple times
|
||||
qc_parse(query_queue, QC_COLLECT_ALL);
|
||||
|
||||
// TODO: Move the handling of queued queries to the client protocol
|
||||
// TODO: module where the command tracking is done automatically.
|
||||
uint8_t cmd = mxs_mysql_get_command(query_queue);
|
||||
mysql_protocol_set_current_command(m_client, (mxs_mysql_cmd_t)cmd);
|
||||
|
||||
if (cmd == MXS_COM_QUERY || cmd == MXS_COM_STMT_PREPARE)
|
||||
{
|
||||
// The query needs to be explicitly parsed as it was processed multiple times
|
||||
qc_parse(query_queue, QC_COLLECT_ALL);
|
||||
}
|
||||
|
||||
if (!routeQuery(query_queue))
|
||||
{
|
||||
rval = false;
|
||||
@ -737,15 +740,6 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb)
|
||||
m_can_replay_trx = true;
|
||||
}
|
||||
|
||||
if (m_expected_responses == 0)
|
||||
{
|
||||
/**
|
||||
* Close stale connections to servers in maintenance. Done here to avoid closing the connections
|
||||
* before all responses have been received.
|
||||
*/
|
||||
close_stale_connections();
|
||||
}
|
||||
|
||||
if (backend->in_use() && backend->has_session_commands())
|
||||
{
|
||||
// Backend is still in use and has more session commands to execute
|
||||
@ -772,6 +766,15 @@ void RWSplitSession::clientReply(GWBUF* writebuf, DCB* backend_dcb)
|
||||
/** Write reply to client DCB */
|
||||
MXS_SESSION_ROUTE_REPLY(backend_dcb->session, writebuf);
|
||||
}
|
||||
|
||||
if (m_expected_responses == 0)
|
||||
{
|
||||
/**
|
||||
* Close stale connections to servers in maintenance. Done here to avoid closing the connections
|
||||
* before all responses have been received.
|
||||
*/
|
||||
close_stale_connections();
|
||||
}
|
||||
}
|
||||
|
||||
void check_and_log_backend_state(const RWBackend* backend, DCB* problem_dcb)
|
||||
|
Reference in New Issue
Block a user