COM_SHOW_SLAVE_STAT wasn't classified but it was treated as 'unknown' and thus routed to master.
This commit is contained in:
VilhoRaatikka
2014-12-03 13:27:31 +02:00
parent 33f77303f7
commit b106560317
2 changed files with 29 additions and 26 deletions

View File

@ -619,6 +619,7 @@ static skygw_query_type_t resolve_query_type(
break; break;
case SQLCOM_SELECT: case SQLCOM_SELECT:
case SQLCOM_SHOW_SLAVE_STAT:
type |= QUERY_TYPE_READ; type |= QUERY_TYPE_READ;
break; break;

View File

@ -1212,10 +1212,11 @@ static bool get_dcb(
* backend and update assign it to new candidate if * backend and update assign it to new candidate if
* necessary. * necessary.
*/ */
else if (SERVER_IS_SLAVE(b->backend_server) && else if (SERVER_IS_SLAVE(b->backend_server))
(max_rlag == MAX_RLAG_UNDEFINED || {
if (max_rlag == MAX_RLAG_UNDEFINED ||
(b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE && (b->backend_server->rlag != MAX_RLAG_NOT_AVAILABLE &&
b->backend_server->rlag <= max_rlag))) b->backend_server->rlag <= max_rlag))
{ {
candidate_bref = check_candidate_bref( candidate_bref = check_candidate_bref(
candidate_bref, candidate_bref,
@ -1232,6 +1233,7 @@ static bool get_dcb(
b->backend_server->port, b->backend_server->port,
b->backend_server->rlag))); b->backend_server->rlag)));
} }
}
} /*< for */ } /*< for */
/** Assign selected DCB's pointer value */ /** Assign selected DCB's pointer value */
if (candidate_bref != NULL) if (candidate_bref != NULL)
@ -1474,7 +1476,7 @@ static route_target_t get_route_target (
QUERY_IS_TYPE(qtype, QUERY_TYPE_UNKNOWN))); QUERY_IS_TYPE(qtype, QUERY_TYPE_UNKNOWN)));
target = TARGET_MASTER; target = TARGET_MASTER;
} }
#if defined(SS_DEBUG) #if defined(SS_EXTRA_DEBUG)
LOGIF(LT, (skygw_log_write( LOGIF(LT, (skygw_log_write(
LOGFILE_TRACE, LOGFILE_TRACE,
"Selected target \"%s\"", "Selected target \"%s\"",
@ -2132,14 +2134,14 @@ static int routeQuery(
rlag_max); rlag_max);
if (succp) if (succp)
{ {
#if defined(SS_DEBUG) #if defined(SS_EXTRA_DEBUG)
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE, LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
"Found DCB for slave."))); "Found DCB for slave.")));
#endif
ss_dassert(get_bref_from_dcb(router_cli_ses, target_dcb) != ss_dassert(get_bref_from_dcb(router_cli_ses, target_dcb) !=
router_cli_ses->rses_master_ref); router_cli_ses->rses_master_ref);
ss_dassert(get_root_master_bref(router_cli_ses) == ss_dassert(get_root_master_bref(router_cli_ses) ==
router_cli_ses->rses_master_ref); router_cli_ses->rses_master_ref);
#endif
atomic_add(&inst->stats.n_slave, 1); atomic_add(&inst->stats.n_slave, 1);
} }
else else