Skip to content

Commit

Permalink
Return next_query_flagIN in qpo
Browse files Browse the repository at this point in the history
This is a minor improvement on pull request #825
  • Loading branch information
renecannao committed Dec 29, 2016
1 parent f35e853 commit 790cc78
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 2 additions & 0 deletions include/query_processor.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class Query_Processor_Output {
int destination_hostgroup;
int mirror_hostgroup;
int mirror_flagOUT;
int next_query_flagIN;
int cache_ttl;
int reconnect;
int timeout;
Expand Down Expand Up @@ -81,6 +82,7 @@ class Query_Processor_Output {
destination_hostgroup=-1;
mirror_hostgroup=-1;
mirror_flagOUT=-1;
next_query_flagIN=-1;
cache_ttl=-1;
reconnect=-1;
timeout=-1;
Expand Down
3 changes: 3 additions & 0 deletions lib/MySQL_Session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3164,6 +3164,9 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C

__exit_set_destination_hostgroup:

if ( qpo->next_query_flagIN >= 0 ) {
next_query_flagIN=qpo->next_query_flagIN;
}
if ( qpo->destination_hostgroup >= 0 ) {
if (transaction_persistent_hostgroup == -1) {
current_hostgroup=qpo->destination_hostgroup;
Expand Down
5 changes: 3 additions & 2 deletions lib/Query_Processor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -710,6 +710,7 @@ Query_Processor_Output * Query_Processor::process_mysql_query(MySQL_Session *ses
QP_rule_t *qr;
re2_t *re2p;
int flagIN=0;
ret->next_query_flagIN=-1; // reset
if (sess->next_query_flagIN >= 0) {
flagIN=sess->next_query_flagIN;
}
Expand Down Expand Up @@ -860,8 +861,8 @@ Query_Processor_Output * Query_Processor::process_mysql_query(MySQL_Session *ses
}
if (qr->next_query_flagIN >= 0) {
// Note: Negative next_query_flagIN means this rule doesn't change the next query flagIN
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 5, "query rule %d has set next query flagIN: %d\n", qr->rule_id, flagIn);
sess->next_query_flagIN=qr->next_query_flagIN;
proxy_debug(PROXY_DEBUG_MYSQL_QUERY_PROCESSOR, 5, "query rule %d has set next query flagIN: %d\n", qr->rule_id, qr->next_query_flagIN);
ret->next_query_flagIN=qr->next_query_flagIN;
}
if (qr->mirror_flagOUT >= 0) {
// Note: negative mirror_flagOUT means this rule doesn't change the mirror flagOUT
Expand Down

0 comments on commit 790cc78

Please sign in to comment.