Fix to bug #694, http://bugs.mariadb.com/show_bug.cgi?id=694
query_classifier.cc: set_query_type lost previous query type if the new was more restrictive. Problem was that if query is both READ and SESSION_WRITE and configuration parameter use_sql_variables_in=all was set, routing target became ambiguous. Replaced call to set_query_type with simply adding new type to type (=bit field) and checking unsupported combinations in readwritesplit.c:get_route_target. If such a case is met, a detailed error is written to error log in readwritesplit.c. mysql_client.c sees the error code and sends an error to client. Then mysql_client.c calls router's handleError which ensures that there are enough backend servers so that the session can continue.
This commit is contained in:
@ -391,29 +391,6 @@ return_here:
|
||||
return failp;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set new query type if new is more restrictive than old.
|
||||
*
|
||||
* Parameters:
|
||||
* @param qtype Existing type
|
||||
*
|
||||
* @param new_type New query type
|
||||
*
|
||||
* @return Query type as an unsigned int value which must be casted to qtype.
|
||||
*
|
||||
*
|
||||
* @details The implementation relies on that enumerated values correspond
|
||||
* to the restrictiviness of the value. That is, smaller value means less
|
||||
* restrictive, for example, QUERY_TYPE_READ is smaller than QUERY_TYPE_WRITE.
|
||||
*
|
||||
*/
|
||||
static u_int32_t set_query_type(
|
||||
u_int32_t* qtype,
|
||||
u_int32_t new_type)
|
||||
{
|
||||
*qtype = MAX(*qtype, new_type);
|
||||
return *qtype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Detect query type by examining parsed representation of it.
|
||||
@ -817,7 +794,7 @@ static skygw_query_type_t resolve_query_type(
|
||||
break;
|
||||
} /**< switch */
|
||||
/**< Set new query type */
|
||||
type |= set_query_type(&type, func_qtype);
|
||||
type |= func_qtype;
|
||||
}
|
||||
#if defined(UPDATE_VAR_SUPPORT)
|
||||
/**
|
||||
|
Reference in New Issue
Block a user