Fix to bug #507, http://bugs.mariadb.com/show_bug.cgi?id=507
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:
@ -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);
|
||||||
|
@ -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) ||
|
||||||
|
Reference in New Issue
Block a user