Fix to bug #543, http://bugs.skysql.com/show_bug.cgi?id=543
All counters are now updated in routeQuery Fix to bug #545, http://bugs.skysql.com/show_bug.cgi?id=545 All sql variable and session modification statements, such as autocommit-, and set <db> commands are routed to all nodes.
This commit is contained in:
@ -454,7 +454,7 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
|
|
||||||
/** SELECT ..INTO variable|OUTFILE|DUMPFILE */
|
/** SELECT ..INTO variable|OUTFILE|DUMPFILE */
|
||||||
if (lex->result != NULL) {
|
if (lex->result != NULL) {
|
||||||
type = QUERY_TYPE_SESSION_WRITE;
|
type = QUERY_TYPE_GSYSVAR_WRITE;
|
||||||
goto return_qtype;
|
goto return_qtype;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -543,7 +543,7 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
else if (lex->sql_command == SQLCOM_SET_OPTION)
|
else if (lex->sql_command == SQLCOM_SET_OPTION)
|
||||||
{
|
{
|
||||||
/** Either user- or system variable write */
|
/** Either user- or system variable write */
|
||||||
type |= QUERY_TYPE_SESSION_WRITE;
|
type |= QUERY_TYPE_GSYSVAR_WRITE;
|
||||||
}
|
}
|
||||||
goto return_qtype;
|
goto return_qtype;
|
||||||
}
|
}
|
||||||
@ -759,7 +759,12 @@ static skygw_query_type_t resolve_query_type(
|
|||||||
break;
|
break;
|
||||||
/** User-defined variable modification */
|
/** User-defined variable modification */
|
||||||
case Item_func::SUSERVAR_FUNC:
|
case Item_func::SUSERVAR_FUNC:
|
||||||
func_qtype |= QUERY_TYPE_SESSION_WRITE;
|
/**
|
||||||
|
* Really it is user variable but we
|
||||||
|
* don't separate sql variables atm.
|
||||||
|
* 15.9.14
|
||||||
|
*/
|
||||||
|
func_qtype |= QUERY_TYPE_GSYSVAR_WRITE;
|
||||||
LOGIF(LD, (skygw_log_write(
|
LOGIF(LD, (skygw_log_write(
|
||||||
LOGFILE_DEBUG,
|
LOGFILE_DEBUG,
|
||||||
"%lu [resolve_query_type] "
|
"%lu [resolve_query_type] "
|
||||||
|
|||||||
@ -1209,13 +1209,15 @@ static route_target_t get_route_target (
|
|||||||
/**
|
/**
|
||||||
* These queries are not affected by hints
|
* These queries are not affected by hints
|
||||||
*/
|
*/
|
||||||
if (!trx_active &&
|
if (QUERY_IS_TYPE(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
||||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_STMT) ||
|
||||||
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
QUERY_IS_TYPE(qtype, QUERY_TYPE_PREPARE_NAMED_STMT) ||
|
||||||
/** Configured to allow writing variables to all nodes */
|
/** Configured to allow writing variables to all nodes */
|
||||||
(use_sql_variables_in == TYPE_ALL &&
|
(use_sql_variables_in == TYPE_ALL &&
|
||||||
(QUERY_IS_TYPE(qtype, QUERY_TYPE_SESSION_WRITE) ||
|
QUERY_IS_TYPE(qtype, QUERY_TYPE_GSYSVAR_WRITE)) ||
|
||||||
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))
|
||||||
{
|
{
|
||||||
/** hints don't affect on routing */
|
/** hints don't affect on routing */
|
||||||
target = TARGET_ALL;
|
target = TARGET_ALL;
|
||||||
@ -1678,8 +1680,6 @@ static int routeQuery(
|
|||||||
}
|
}
|
||||||
goto retblock;
|
goto retblock;
|
||||||
}
|
}
|
||||||
inst->stats.n_queries++;
|
|
||||||
|
|
||||||
master_dcb = router_cli_ses->rses_master_ref->bref_dcb;
|
master_dcb = router_cli_ses->rses_master_ref->bref_dcb;
|
||||||
CHK_DCB(master_dcb);
|
CHK_DCB(master_dcb);
|
||||||
|
|
||||||
@ -1808,6 +1808,7 @@ static int routeQuery(
|
|||||||
|
|
||||||
if (succp)
|
if (succp)
|
||||||
{
|
{
|
||||||
|
atomic_add(&inst->stats.n_all, 1);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
}
|
}
|
||||||
goto retblock;
|
goto retblock;
|
||||||
@ -1904,6 +1905,10 @@ static int routeQuery(
|
|||||||
BE_SLAVE,
|
BE_SLAVE,
|
||||||
NULL,
|
NULL,
|
||||||
rlag_max);
|
rlag_max);
|
||||||
|
if (succp)
|
||||||
|
{
|
||||||
|
atomic_add(&inst->stats.n_slave, 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!succp && TARGET_IS_MASTER(route_target))
|
if (!succp && TARGET_IS_MASTER(route_target))
|
||||||
@ -1920,6 +1925,7 @@ static int routeQuery(
|
|||||||
{
|
{
|
||||||
succp = true;
|
succp = true;
|
||||||
}
|
}
|
||||||
|
atomic_add(&inst->stats.n_master, 1);
|
||||||
target_dcb = master_dcb;
|
target_dcb = master_dcb;
|
||||||
}
|
}
|
||||||
ss_dassert(succp);
|
ss_dassert(succp);
|
||||||
@ -1931,7 +1937,7 @@ static int routeQuery(
|
|||||||
{
|
{
|
||||||
backend_ref_t* bref;
|
backend_ref_t* bref;
|
||||||
|
|
||||||
atomic_add(&inst->stats.n_slave, 1);
|
atomic_add(&inst->stats.n_queries, 1);
|
||||||
/**
|
/**
|
||||||
* Add one query response waiter to backend reference
|
* Add one query response waiter to backend reference
|
||||||
*/
|
*/
|
||||||
@ -3678,8 +3684,6 @@ static bool route_session_write(
|
|||||||
/** Unlock router session */
|
/** Unlock router session */
|
||||||
rses_end_locked_router_action(router_cli_ses);
|
rses_end_locked_router_action(router_cli_ses);
|
||||||
|
|
||||||
atomic_add(&inst->stats.n_all, 1);
|
|
||||||
|
|
||||||
return_succp:
|
return_succp:
|
||||||
return succp;
|
return succp;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user