Merge branch 'develop' into MAX-324

This commit is contained in:
Markus Makela
2015-01-29 20:36:26 +02:00
17 changed files with 384 additions and 158 deletions

View File

@ -1402,17 +1402,19 @@ static route_target_t get_route_target (
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))) /*< read global sys var */
{
/** 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' */
/** Configured to allow reading variables from slaves */
(use_sql_variables_in == TYPE_ALL &&
(QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) ||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ) ||
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))))
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ)))))
{
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 */
(use_sql_variables_in == TYPE_MASTER &&
(QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) ||
@ -2198,17 +2200,32 @@ static bool route_single_stmt(
}
if (bref != NULL && BREF_IS_IN_USE(bref))
{
{
/** Create and add MySQL error to eventqueue */
modutil_reply_parse_error(
bref->bref_dcb,
strdup("Routing query to backend failed. "
"See the error log for further "
"details."),
0);
}
succp = true;
}
else
{
/**
* If there were no available backend references
* available return false - session will be closed
*/
LOGIF(LE, (skygw_log_write_flush(
LOGFILE_ERROR,
"Error : Sending error message to client "
"failed. Router doesn't have any "
"available backends. Session will be "
"closed.")));
succp = false;
}
if (query_str) free (query_str);
if (qtype_str) free(qtype_str);
succp = true;
goto retblock;
}
/**
@ -4411,7 +4428,8 @@ static void rwsplit_process_router_options(
* @param errmsgbuf The error message to reply
* @param backend_dcb The backend DCB
* @param action The action: REPLY, REPLY_AND_CLOSE, NEW_CONNECTION
* @param succp Result of action.
* @param succp Result of action. True if there is at least master
* and enough slaves to continue session. Otherwise false.
*
* Even if succp == true connecting to new slave may have failed. succp is to
* tell whether router has enough master/slave connections to continue work.