Fix to bug # 634, http://bugs.skysql.com/show_bug.cgi?id=634
COM_SHOW_SLAVE_STAT wasn't classified but it was treated as 'unknown' and thus routed to master.
This commit is contained in:
@ -619,6 +619,7 @@ static skygw_query_type_t resolve_query_type(
|
||||
break;
|
||||
|
||||
case SQLCOM_SELECT:
|
||||
case SQLCOM_SHOW_SLAVE_STAT:
|
||||
type |= QUERY_TYPE_READ;
|
||||
break;
|
||||
|
||||
|
||||
@ -1212,10 +1212,11 @@ static bool get_dcb(
|
||||
* backend and update assign it to new candidate if
|
||||
* necessary.
|
||||
*/
|
||||
else if (SERVER_IS_SLAVE(b->backend_server) &&
|
||||
(max_rlag == MAX_RLAG_UNDEFINED ||
|
||||
else if (SERVER_IS_SLAVE(b->backend_server))
|
||||
{
|
||||
if (max_rlag == MAX_RLAG_UNDEFINED ||
|
||||
(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,
|
||||
@ -1232,6 +1233,7 @@ static bool get_dcb(
|
||||
b->backend_server->port,
|
||||
b->backend_server->rlag)));
|
||||
}
|
||||
}
|
||||
} /*< for */
|
||||
/** Assign selected DCB's pointer value */
|
||||
if (candidate_bref != NULL)
|
||||
@ -1474,7 +1476,7 @@ static route_target_t get_route_target (
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_UNKNOWN)));
|
||||
target = TARGET_MASTER;
|
||||
}
|
||||
#if defined(SS_DEBUG)
|
||||
#if defined(SS_EXTRA_DEBUG)
|
||||
LOGIF(LT, (skygw_log_write(
|
||||
LOGFILE_TRACE,
|
||||
"Selected target \"%s\"",
|
||||
@ -2132,14 +2134,14 @@ static int routeQuery(
|
||||
rlag_max);
|
||||
if (succp)
|
||||
{
|
||||
#if defined(SS_DEBUG)
|
||||
#if defined(SS_EXTRA_DEBUG)
|
||||
LOGIF(LT, (skygw_log_write(LOGFILE_TRACE,
|
||||
"Found DCB for slave.")));
|
||||
#endif
|
||||
ss_dassert(get_bref_from_dcb(router_cli_ses, target_dcb) !=
|
||||
router_cli_ses->rses_master_ref);
|
||||
ss_dassert(get_root_master_bref(router_cli_ses) ==
|
||||
router_cli_ses->rses_master_ref);
|
||||
#endif
|
||||
atomic_add(&inst->stats.n_slave, 1);
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user