Added QUERY_TYPE_GLOBAL_WRITE for writes which don't reflect on binary log, but need to be present in every back-end server once executed.

This commit is contained in:
vraatikka
2013-12-11 14:34:01 +02:00
parent f785420cc6
commit 06ebc6f4b5
2 changed files with 18 additions and 4 deletions

View File

@ -418,14 +418,27 @@ static skygw_query_type_t resolve_query_type(
* PRELOAD_KEYS, FLUSH, RESET, CREATE|ALTER|DROP SERVER * PRELOAD_KEYS, FLUSH, RESET, CREATE|ALTER|DROP SERVER
*/ */
if (sql_command_flags[lex->sql_command] & CF_AUTO_COMMIT_TRANS) { if (sql_command_flags[lex->sql_command] & CF_AUTO_COMMIT_TRANS) {
qtype = QUERY_TYPE_SESSION_WRITE; if (lex->option_type == OPT_GLOBAL)
goto return_here; {
qtype = QUERY_TYPE_GLOBAL_WRITE;
}
else
{
qtype = QUERY_TYPE_SESSION_WRITE;
}
goto return_here;
} }
/** Try to catch session modifications here */ /** Try to catch session modifications here */
switch (lex->sql_command) { switch (lex->sql_command) {
case SQLCOM_CHANGE_DB:
case SQLCOM_SET_OPTION: case SQLCOM_SET_OPTION:
if (lex->option_type == OPT_GLOBAL)
{
qtype = QUERY_TYPE_GLOBAL_WRITE;
break;
}
/**<! fall through */
case SQLCOM_CHANGE_DB:
qtype = QUERY_TYPE_SESSION_WRITE; qtype = QUERY_TYPE_SESSION_WRITE;
break; break;

View File

@ -33,7 +33,8 @@ typedef enum {
QUERY_TYPE_LOCAL_READ, /*!< Read non-database data, execute in MaxScale */ QUERY_TYPE_LOCAL_READ, /*!< Read non-database data, execute in MaxScale */
QUERY_TYPE_READ, /*!< No updates */ QUERY_TYPE_READ, /*!< No updates */
QUERY_TYPE_WRITE, /*!< Master data will be modified */ QUERY_TYPE_WRITE, /*!< Master data will be modified */
QUERY_TYPE_SESSION_WRITE /*!< Session data will be modified */ QUERY_TYPE_SESSION_WRITE,/*!< Session data will be modified */
QUERY_TYPE_GLOBAL_WRITE /*!< Global system variable modification */
} skygw_query_type_t; } skygw_query_type_t;