Merge branch '2.2' into develop

This commit is contained in:
Johan Wikman
2018-03-01 18:08:45 +02:00
18 changed files with 330 additions and 117 deletions

View File

@ -548,27 +548,20 @@ static inline bool connection_is_valid(ROUTER_INSTANCE* inst, ROUTER_CLIENT_SES*
if (SERVER_IS_RUNNING(router_cli_ses->backend->server) &&
(router_cli_ses->backend->server->status & inst->bitmask & inst->bitvalue))
{
if (inst->bitvalue & SERVER_MASTER)
if ((inst->bitvalue & SERVER_MASTER) && router_cli_ses->backend->active)
{
SERVER_REF* master = get_root_master(inst->service->dbref);
if (master)
{
/** Check that the master we are connected to and the one we
* determined from the replication topology are one and the same */
rval = router_cli_ses->backend == get_root_master(inst->service->dbref);
}
else
{
/** No master is available but the one we are connected to is
* still a master. This most likely means that the servers for
* the service have been modified at runtime. */
rval = true;
}
// If we're using an active master server, verify that it is still a master
rval = router_cli_ses->backend == get_root_master(inst->service->dbref);
}
else
{
// Not a master and bitmask check is OK, everything is OK
/**
* Either we don't use master type servers or the server reference
* is deactivated. We let deactivated connection close gracefully
* so we simply assume it is OK. This allows a server to be taken
* out of use in a manner that won't cause errors to the connected
* clients.
*/
rval = true;
}
}

View File

@ -174,12 +174,13 @@ log_transaction_status(RWSplitSession *rses, GWBUF *querybuf, uint32_t qtype)
MXS_SESSION *ses = rses->client_dcb->session;
const char *autocommit = session_is_autocommit(ses) ? "[enabled]" : "[disabled]";
const char *transaction = session_trx_is_active(ses) ? "[open]" : "[not open]";
uint32_t plen = MYSQL_GET_PACKET_LEN(querybuf);
const char *querytype = qtypestr == NULL ? "N/A" : qtypestr;
const char *hint = querybuf->hint == NULL ? "" : ", Hint:";
const char *hint_type = querybuf->hint == NULL ? "" : STRHINTTYPE(querybuf->hint->type);
MXS_INFO("> Autocommit: %s, trx is %s, cmd: (0x%02x) %s, type: %s, stmt: %.*s%s %s",
autocommit, transaction, command, STRPACKETTYPE(command),
MXS_INFO("> Autocommit: %s, trx is %s, cmd: (0x%02x) %s, plen: %u, type: %s, pastmt: %.*s%s %s",
autocommit, transaction, command, STRPACKETTYPE(command), plen,
querytype, len, sql, hint, hint_type);
MXS_FREE(qtypestr);

View File

@ -835,10 +835,10 @@ handle_multi_temp_and_load(RWSplitSession *rses, GWBUF *querybuf,
/**
* Check if the query has anything to do with temporary tables.
*/
if (rses->have_tmp_tables)
if (rses->have_tmp_tables && is_packet_a_query(packet_type))
{
check_drop_tmp_table(rses, querybuf);
if (is_packet_a_query(packet_type) && is_read_tmp_table(rses, querybuf, *qtype))
if (is_read_tmp_table(rses, querybuf, *qtype))
{
*qtype |= QUERY_TYPE_MASTER_READ;
}