Merge branch 'develop' into MXS-930
This commit is contained in:
@ -601,9 +601,9 @@ config_load_and_process(const char* filename, bool (*process_config)(CONFIG_CONT
|
||||
|
||||
if (rval)
|
||||
{
|
||||
if (check_config_objects(ccontext.next) && process_config(ccontext.next))
|
||||
if (!check_config_objects(ccontext.next) || !process_config(ccontext.next))
|
||||
{
|
||||
rval = true;
|
||||
rval = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -633,13 +633,9 @@ config_load(const char *filename)
|
||||
global_defaults();
|
||||
feedback_defaults();
|
||||
|
||||
config_file = filename;
|
||||
bool rval = config_load_and_process(filename, process_config_context);
|
||||
|
||||
if (rval)
|
||||
{
|
||||
config_file = filename;
|
||||
}
|
||||
|
||||
return rval;
|
||||
}
|
||||
|
||||
|
@ -197,6 +197,14 @@ char* qc_get_affected_fields(GWBUF* query)
|
||||
return classifier->qc_get_affected_fields(query);
|
||||
}
|
||||
|
||||
void qc_get_field_info(GWBUF* query, const QC_FIELD_INFO** infos, size_t* n_infos)
|
||||
{
|
||||
QC_TRACE();
|
||||
ss_dassert(classifier);
|
||||
|
||||
classifier->qc_get_field_info(query, infos, n_infos);
|
||||
}
|
||||
|
||||
char** qc_get_database_names(GWBUF* query, int* sizep)
|
||||
{
|
||||
QC_TRACE();
|
||||
|
@ -45,9 +45,9 @@
|
||||
static int
|
||||
test1()
|
||||
{
|
||||
USERS *users;
|
||||
char *authdata;
|
||||
int result, count;
|
||||
USERS *users;
|
||||
const char *authdata;
|
||||
int result, count;
|
||||
|
||||
/* Poll tests */
|
||||
ss_dfprintf(stderr,
|
||||
|
@ -87,12 +87,12 @@ users_free(USERS *users)
|
||||
* @return The number of users added to the table
|
||||
*/
|
||||
int
|
||||
users_add(USERS *users, char *user, char *auth)
|
||||
users_add(USERS *users, const char *user, const char *auth)
|
||||
{
|
||||
int add;
|
||||
|
||||
atomic_add(&users->stats.n_adds, 1);
|
||||
add = hashtable_add(users->data, user, auth);
|
||||
add = hashtable_add(users->data, (char*)user, (char*)auth);
|
||||
atomic_add(&users->stats.n_entries, add);
|
||||
return add;
|
||||
}
|
||||
@ -105,12 +105,12 @@ users_add(USERS *users, char *user, char *auth)
|
||||
* @return The number of users deleted from the table
|
||||
*/
|
||||
int
|
||||
users_delete(USERS *users, char *user)
|
||||
users_delete(USERS *users, const char *user)
|
||||
{
|
||||
int del;
|
||||
|
||||
atomic_add(&users->stats.n_deletes, 1);
|
||||
del = hashtable_delete(users->data, user);
|
||||
del = hashtable_delete(users->data, (char*)user);
|
||||
atomic_add(&users->stats.n_entries, -del);
|
||||
return del;
|
||||
}
|
||||
@ -122,11 +122,12 @@ users_delete(USERS *users, char *user)
|
||||
* @param user The user name
|
||||
* @return The authentication data or NULL on error
|
||||
*/
|
||||
char
|
||||
*users_fetch(USERS *users, char *user)
|
||||
const char
|
||||
*users_fetch(USERS *users, const char *user)
|
||||
{
|
||||
atomic_add(&users->stats.n_fetches, 1);
|
||||
return hashtable_fetch(users->data, user);
|
||||
// TODO: Returning data from the hashtable is not threadsafe.
|
||||
return hashtable_fetch(users->data, (char*)user);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,13 +140,13 @@ char
|
||||
* @return Number of users updated
|
||||
*/
|
||||
int
|
||||
users_update(USERS *users, char *user, char *auth)
|
||||
users_update(USERS *users, const char *user, const char *auth)
|
||||
{
|
||||
if (hashtable_delete(users->data, user) == 0)
|
||||
if (hashtable_delete(users->data, (char*)user) == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
return hashtable_add(users->data, user, auth);
|
||||
return hashtable_add(users->data, (char*)user, (char*)auth);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -154,7 +155,7 @@ users_update(USERS *users, char *user, char *auth)
|
||||
* @param users The users table
|
||||
*/
|
||||
void
|
||||
usersPrint(USERS *users)
|
||||
usersPrint(const USERS *users)
|
||||
{
|
||||
printf("Users table data\n");
|
||||
hashtable_stats(users->data);
|
||||
@ -167,7 +168,7 @@ usersPrint(USERS *users)
|
||||
* @param users The users table
|
||||
*/
|
||||
void
|
||||
dcb_usersPrint(DCB *dcb, USERS *users)
|
||||
dcb_usersPrint(DCB *dcb, const USERS *users)
|
||||
{
|
||||
if (users == NULL || users->data == NULL)
|
||||
{
|
||||
|
@ -139,7 +139,7 @@ static int cdc_auth_check(DCB *dcb, CDC_protocol *protocol, char *username, uint
|
||||
{
|
||||
if (dcb->listener->users)
|
||||
{
|
||||
char *user_password = users_fetch(dcb->listener->users, username);
|
||||
const char *user_password = users_fetch(dcb->listener->users, username);
|
||||
|
||||
if (user_password)
|
||||
{
|
||||
|
@ -1,7 +1,7 @@
|
||||
# Build RocksDB
|
||||
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.7)))
|
||||
message(STATUS "GCC >= 4.7, RocksDB is built.")
|
||||
if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)))
|
||||
message(STATUS "GCC >= 4.8, RocksDB is built.")
|
||||
|
||||
set(ROCKSDB_REPO "https://github.com/facebook/rocksdb.git"
|
||||
CACHE STRING "RocksDB Git repository")
|
||||
|
@ -570,7 +570,7 @@ static void diagnostic(FILTER *instance, void *fsession, DCB *dcb)
|
||||
lua_gettop(my_instance->global_lua_state);
|
||||
if (lua_isstring(my_instance->global_lua_state, -1))
|
||||
{
|
||||
dcb_printf(dcb, lua_tostring(my_instance->global_lua_state, -1));
|
||||
dcb_printf(dcb, "%s", lua_tostring(my_instance->global_lua_state, -1));
|
||||
dcb_printf(dcb, "\n");
|
||||
}
|
||||
}
|
||||
|
@ -681,11 +681,15 @@ static MONITOR_SERVERS *get_candidate_master(MONITOR* mon)
|
||||
|
||||
if (handle->use_priority && (value = serverGetParameter(moitor_servers->server, "priority")) != NULL)
|
||||
{
|
||||
currval = atoi(value);
|
||||
if (currval < minval && currval > 0)
|
||||
/** The server has a priority */
|
||||
if ((currval = atoi(value)) > 0)
|
||||
{
|
||||
minval = currval;
|
||||
candidate_master = moitor_servers;
|
||||
/** The priority is valid */
|
||||
if (currval < minval && currval > 0)
|
||||
{
|
||||
minval = currval;
|
||||
candidate_master = moitor_servers;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (moitor_servers->server->node_id >= 0 &&
|
||||
|
@ -84,7 +84,7 @@ bool route_single_stmt(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES *rses,
|
||||
* transaction is committed and autocommit is enabled again.
|
||||
*/
|
||||
if (rses->rses_autocommit_enabled &&
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT))
|
||||
qc_query_is_type(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT))
|
||||
{
|
||||
rses->rses_autocommit_enabled = false;
|
||||
|
||||
@ -94,7 +94,7 @@ bool route_single_stmt(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES *rses,
|
||||
}
|
||||
}
|
||||
else if (!rses->rses_transaction_active &&
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_BEGIN_TRX))
|
||||
qc_query_is_type(qtype, QUERY_TYPE_BEGIN_TRX))
|
||||
{
|
||||
rses->rses_transaction_active = true;
|
||||
}
|
||||
@ -102,13 +102,13 @@ bool route_single_stmt(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES *rses,
|
||||
* Explicit COMMIT and ROLLBACK, implicit COMMIT.
|
||||
*/
|
||||
if (rses->rses_autocommit_enabled && rses->rses_transaction_active &&
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_COMMIT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_ROLLBACK)))
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_COMMIT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_ROLLBACK)))
|
||||
{
|
||||
rses->rses_transaction_active = false;
|
||||
}
|
||||
else if (!rses->rses_autocommit_enabled &&
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT))
|
||||
qc_query_is_type(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT))
|
||||
{
|
||||
rses->rses_autocommit_enabled = true;
|
||||
rses->rses_transaction_active = false;
|
||||
@ -727,13 +727,13 @@ route_target_t get_route_target(ROUTER_CLIENT_SES *rses,
|
||||
* These queries are not affected by hints
|
||||
*/
|
||||
else if (!load_active &&
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||
/** Configured to allow writing variables to all nodes */
|
||||
(use_sql_variables_in == TYPE_ALL &&
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_WRITE)) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_WRITE)) ||
|
||||
/** enable or disable autocommit are always routed to all */
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT)))
|
||||
qc_query_is_type(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT)))
|
||||
{
|
||||
/**
|
||||
* This is problematic query because it would be routed to all
|
||||
@ -750,9 +750,9 @@ route_target_t get_route_target(ROUTER_CLIENT_SES *rses,
|
||||
* the execution of the prepared statements to the right server would be
|
||||
* an easy one. Currently this is not supported.
|
||||
*/
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) &&
|
||||
!(QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_NAMED_STMT)))
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_READ) &&
|
||||
!(qc_query_is_type(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_NAMED_STMT)))
|
||||
{
|
||||
MXS_WARNING("The query can't be routed to all "
|
||||
"backend servers because it includes SELECT and "
|
||||
@ -770,40 +770,40 @@ route_target_t get_route_target(ROUTER_CLIENT_SES *rses,
|
||||
* Hints may affect on routing of the following queries
|
||||
*/
|
||||
else if (!trx_active && !load_active &&
|
||||
!QUERY_IS_TYPE(qtype, QUERY_TYPE_WRITE) &&
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) || /*< any SELECT */
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SHOW_TABLES) || /*< 'SHOW TABLES' */
|
||||
QUERY_IS_TYPE(qtype,
|
||||
QUERY_TYPE_USERVAR_READ) || /*< read user var */
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ) || /*< read sys var */
|
||||
QUERY_IS_TYPE(qtype,
|
||||
QUERY_TYPE_EXEC_STMT) || /*< prepared stmt exec */
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||
QUERY_IS_TYPE(qtype,
|
||||
QUERY_TYPE_GSYSVAR_READ))) /*< read global sys var */
|
||||
!qc_query_is_type(qtype, QUERY_TYPE_WRITE) &&
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_READ) || /*< any SELECT */
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SHOW_TABLES) || /*< 'SHOW TABLES' */
|
||||
qc_query_is_type(qtype,
|
||||
QUERY_TYPE_USERVAR_READ) || /*< read user var */
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ) || /*< read sys var */
|
||||
qc_query_is_type(qtype,
|
||||
QUERY_TYPE_EXEC_STMT) || /*< prepared stmt exec */
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||
qc_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_MASTER_READ) &&
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SHOW_TABLES) || /*< 'SHOW TABLES' */
|
||||
if (!qc_query_is_type(qtype, QUERY_TYPE_MASTER_READ) &&
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_READ) ||
|
||||
qc_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)))))
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_READ)))))
|
||||
{
|
||||
target = TARGET_SLAVE;
|
||||
}
|
||||
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_EXEC_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_MASTER_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_EXEC_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||
/** Configured not to allow reading variables from slaves */
|
||||
(use_sql_variables_in == TYPE_MASTER &&
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ))))
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ))))
|
||||
{
|
||||
target = TARGET_MASTER;
|
||||
}
|
||||
@ -818,26 +818,26 @@ route_target_t get_route_target(ROUTER_CLIENT_SES *rses,
|
||||
{
|
||||
/** hints don't affect on routing */
|
||||
ss_dassert(trx_active ||
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_WRITE) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_MASTER_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) &&
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_WRITE) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_MASTER_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_USERVAR_READ) &&
|
||||
use_sql_variables_in == TYPE_MASTER) ||
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ) &&
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ) &&
|
||||
use_sql_variables_in == TYPE_MASTER) ||
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ) &&
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_READ) &&
|
||||
use_sql_variables_in == TYPE_MASTER) ||
|
||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_WRITE) &&
|
||||
(qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_WRITE) &&
|
||||
use_sql_variables_in == TYPE_MASTER) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_BEGIN_TRX) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_ROLLBACK) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_COMMIT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_EXEC_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_CREATE_TMP_TABLE) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_READ_TMP_TABLE) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_UNKNOWN)));
|
||||
qc_query_is_type(qtype, QUERY_TYPE_BEGIN_TRX) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_ROLLBACK) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_COMMIT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_EXEC_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_CREATE_TMP_TABLE) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_READ_TMP_TABLE) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_UNKNOWN)));
|
||||
target = TARGET_MASTER;
|
||||
}
|
||||
|
||||
|
@ -147,11 +147,11 @@ qc_query_type_t is_read_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
|
||||
dbname = (char *)data->db;
|
||||
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_LOCAL_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_LOCAL_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_READ))
|
||||
{
|
||||
tbl = qc_get_table_names(querybuf, &tsize, false);
|
||||
|
||||
@ -199,7 +199,7 @@ qc_query_type_t is_read_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
void check_create_tmp_table(ROUTER_CLIENT_SES *router_cli_ses,
|
||||
GWBUF *querybuf, qc_query_type_t type)
|
||||
{
|
||||
if (!QUERY_IS_TYPE(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
||||
if (!qc_query_is_type(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -524,7 +524,7 @@ char* get_shard_target_name(ROUTER_INSTANCE* router,
|
||||
|
||||
/* Check if the query is a show tables query with a specific database */
|
||||
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_SHOW_TABLES))
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_SHOW_TABLES))
|
||||
{
|
||||
query = modutil_get_SQL(buffer);
|
||||
if ((tmp = strcasestr(query, "from")))
|
||||
@ -1457,19 +1457,19 @@ static route_target_t get_shard_route_target(qc_query_type_t qtype,
|
||||
/**
|
||||
* These queries are not affected by hints
|
||||
*/
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_WRITE) ||
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_WRITE) ||
|
||||
/** enable or disable autocommit are always routed to all */
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT))
|
||||
qc_query_is_type(qtype, QUERY_TYPE_ENABLE_AUTOCOMMIT) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_DISABLE_AUTOCOMMIT))
|
||||
{
|
||||
/** hints don't affect on routing */
|
||||
target = TARGET_ALL;
|
||||
}
|
||||
else if (QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))
|
||||
else if (qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_READ))
|
||||
{
|
||||
target = TARGET_ANY;
|
||||
}
|
||||
@ -1559,11 +1559,11 @@ qc_query_type_t is_read_tmp_table(ROUTER* instance,
|
||||
rses_prop_tmp = router_cli_ses->rses_properties[RSES_PROP_TYPE_TMPTABLES];
|
||||
dbname = router_cli_ses->current_db;
|
||||
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_LOCAL_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_READ))
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_LOCAL_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_USERVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_SYSVAR_READ) ||
|
||||
qc_query_is_type(qtype, QUERY_TYPE_GSYSVAR_READ))
|
||||
{
|
||||
tbl = qc_get_table_names(querybuf, &tsize, false);
|
||||
|
||||
@ -1633,7 +1633,7 @@ void check_create_tmp_table(ROUTER* instance,
|
||||
rses_prop_tmp = router_cli_ses->rses_properties[RSES_PROP_TYPE_TMPTABLES];
|
||||
dbname = router_cli_ses->current_db;
|
||||
|
||||
if (QUERY_IS_TYPE(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
||||
if (qc_query_is_type(type, QUERY_TYPE_CREATE_TMP_TABLE))
|
||||
{
|
||||
bool is_temp = true;
|
||||
char* tblname = NULL;
|
||||
@ -2081,7 +2081,7 @@ static int routeQuery(ROUTER* instance,
|
||||
}
|
||||
|
||||
/** Create the response to the SHOW DATABASES from the mapped databases */
|
||||
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_SHOW_DATABASES))
|
||||
if (qc_query_is_type(qtype, QUERY_TYPE_SHOW_DATABASES))
|
||||
{
|
||||
if (send_database_list(inst, router_cli_ses))
|
||||
{
|
||||
|
Reference in New Issue
Block a user