readwritesplit.c:get_route_target routed query to slave although query type was combined QUERY_TYPE_READ | QUERY_TYPE_MASTER_READ, where the latter is supposed to be routed to master.
This commit is contained in:
VilhoRaatikka
2015-01-27 15:21:31 +02:00
parent 270c0ebf8a
commit 21bb341c7d
2 changed files with 5 additions and 2 deletions

View File

@ -980,6 +980,7 @@ SERVICE *ptr;
} }
while (ptr) while (ptr)
{ {
ss_dassert(ptr->stats.n_current >= 0);
dcb_printf(dcb, "%-25s | %-20s | %6d | %5d\n", dcb_printf(dcb, "%-25s | %-20s | %6d | %5d\n",
ptr->name, ptr->routerModule, ptr->name, ptr->routerModule,
ptr->stats.n_current, ptr->stats.n_sessions); ptr->stats.n_current, ptr->stats.n_sessions);

View File

@ -1402,7 +1402,8 @@ static route_target_t get_route_target (
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))) /*< read global sys var */ QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))) /*< read global sys var */
{ {
/** First set expected targets before evaluating hints */ /** First set expected targets before evaluating hints */
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) || if (!QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) &&
QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) ||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SHOW_TABLES) || /*< 'SHOW TABLES' */ QUERY_IS_TYPE(qtype, QUERY_TYPE_SHOW_TABLES) || /*< 'SHOW TABLES' */
/** Configured to allow reading variables from slaves */ /** Configured to allow reading variables from slaves */
(use_sql_variables_in == TYPE_ALL && (use_sql_variables_in == TYPE_ALL &&
@ -1412,7 +1413,8 @@ static route_target_t get_route_target (
{ {
target = TARGET_SLAVE; target = TARGET_SLAVE;
} }
else if (QUERY_IS_TYPE(qtype, QUERY_TYPE_EXEC_STMT) || else if (QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
QUERY_IS_TYPE(qtype, QUERY_TYPE_EXEC_STMT) ||
/** Configured not to allow reading variables from slaves */ /** Configured not to allow reading variables from slaves */
(use_sql_variables_in == TYPE_MASTER && (use_sql_variables_in == TYPE_MASTER &&
(QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) || (QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) ||