Change default of exit_after_SetParse

In handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_COM_QUERY_qpo()
Changing the default of exit_after_SetParse from false to true.
If a variable isn't parsed or it needs to be forwarded, exit_after_SetParse is set to false
v2.0.13-autocommit_fix
René Cannaò 6 years ago
parent ba80d84567
commit c1d2c876db

@ -49,8 +49,8 @@ public:
bool verify_variable(MySQL_Session* session, int idx) const;
bool update_variable(MySQL_Session* session, session_status status, int &_rc);
bool on_connect_to_backend(MySQL_Connection *myconn);
bool parse_variable_boolean(MySQL_Session *sess, int idx, std::string &value1, bool& exit_after_SetParse, bool* lock_hostgroup);
bool parse_variable_number(MySQL_Session *sess, int idx, std::string &value1, bool& exit_after_SetParse, bool* lock_hostgroup);
bool parse_variable_boolean(MySQL_Session *sess, int idx, std::string &value1, bool* lock_hostgroup);
bool parse_variable_number(MySQL_Session *sess, int idx, std::string &value1, bool* lock_hostgroup);
};
#endif // #ifndef MYSQL_VARIABLES_H

@ -4833,7 +4833,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
This algorithm will be become obsolete once we implement session
tracking for MySQL 5.7+
*/
bool exit_after_SetParse = false;
bool exit_after_SetParse = true;
unsigned char command_type=*((unsigned char *)pkt->ptr+sizeof(mysql_hdr));
if (qpo->new_query) {
// the query was rewritten
@ -5056,7 +5056,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
}
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection SQL Mode to %s\n", value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
// the following two blocks of code will be simplified later
} else if ((var == "sql_auto_is_null") || (var == "sql_safe_updates")) {
int idx = SQL_NAME_LAST;
@ -5069,7 +5069,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
}
}
if (idx != SQL_NAME_LAST) {
if (mysql_variables.parse_variable_boolean(this,idx, *values, exit_after_SetParse, lock_hostgroup)==false) {
if (mysql_variables.parse_variable_boolean(this,idx, *values, lock_hostgroup)==false) {
return false;
}
}
@ -5084,7 +5084,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
}
}
if (idx != SQL_NAME_LAST) {
if (mysql_variables.parse_variable_number(this,idx, *values, exit_after_SetParse, lock_hostgroup)==false) {
if (mysql_variables.parse_variable_number(this,idx, *values, lock_hostgroup)==false) {
return false;
}
}
@ -5127,7 +5127,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
autocommit=true;
client_myds->myconn->set_autocommit(autocommit);
autocommit_on_hostgroup=FindOneActiveTransaction();
exit_after_SetParse = true;
exit_after_SetParse = false;
} else {
// as there is no active transaction, we do no need to forward it
// just change internal state
@ -5142,7 +5142,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
}
} else {
if (autocommit_handled==true) {
exit_after_SetParse = true;
exit_after_SetParse = false;
}
}
} else if (var == "time_zone") {
@ -5159,7 +5159,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return false;
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection Time zone to %s\n", value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else if (var == "session_track_gtids") {
std::string value1 = *values;
if ((strcasecmp(value1.c_str(),"OWN_GTID")==0) || (strcasecmp(value1.c_str(),"OFF")==0)) {
@ -5173,7 +5173,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Changing connection session_track_gtids to %s\n", value1.c_str());
client_myds->myconn->options.session_track_gtids=strdup(value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else {
unable_to_parse_set_statement(lock_hostgroup);
return false;
@ -5252,7 +5252,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Changing connection %s to %s\n", var.c_str(), value1.c_str());
}
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else {
unable_to_parse_set_statement(lock_hostgroup);
return false;
@ -5295,7 +5295,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
} else {
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection charset to %d\n", c->nr);
client_myds->myconn->set_charset(c->nr, NAMES);
exit_after_SetParse = true;
//exit_after_SetParse = true;
}
} else if (var == "tx_isolation") {
std::string value1 = *values;
@ -5309,7 +5309,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return false;
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection TX ISOLATION to %s\n", value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else {
std::string value1 = *values;
std::size_t found_at = value1.find("@");
@ -5426,7 +5426,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return false;
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection TRANSACTION ISOLATION LEVEL to %s\n", value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else if (var == "read") {
std::string value1 = *values;
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Processing SET SESSION TRANSACTION READ value %s\n", value1.c_str());
@ -5436,7 +5436,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
return false;
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection TRANSACTION READ to %s\n", value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else {
unable_to_parse_set_statement(lock_hostgroup);
return false;
@ -5481,7 +5481,7 @@ bool MySQL_Session::handler___status_WAITING_CLIENT_DATA___STATE_SLEEP___MYSQL_C
} else {
proxy_debug(PROXY_DEBUG_MYSQL_COM, 8, "Changing connection charset to %d\n", c->nr);
client_myds->myconn->set_charset(c->nr, CHARSET);
exit_after_SetParse = true;
//exit_after_SetParse = true;
}
if (exit_after_SetParse) {
if (command_type == _MYSQL_COM_QUERY) {

@ -451,7 +451,7 @@ bool logbin_update_server_variable(MySQL_Session* session, int idx, int &_rc) {
}
bool MySQL_Variables::parse_variable_boolean(MySQL_Session *sess, int idx, string& value1, bool& exit_after_SetParse, bool * lock_hostgroup) {
bool MySQL_Variables::parse_variable_boolean(MySQL_Session *sess, int idx, string& value1, bool * lock_hostgroup) {
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Processing SET %s value %s\n", mysql_tracked_variables[idx].set_variable_name, value1.c_str());
int __tmp_value = -1;
if (
@ -483,7 +483,7 @@ bool MySQL_Variables::parse_variable_boolean(MySQL_Session *sess, int idx, strin
}
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Changing connection %s to %s\n", mysql_tracked_variables[idx].set_variable_name, value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else {
sess->unable_to_parse_set_statement(lock_hostgroup);
return false;
@ -493,7 +493,7 @@ bool MySQL_Variables::parse_variable_boolean(MySQL_Session *sess, int idx, strin
bool MySQL_Variables::parse_variable_number(MySQL_Session *sess, int idx, string& value1, bool& exit_after_SetParse, bool * lock_hostgroup) {
bool MySQL_Variables::parse_variable_number(MySQL_Session *sess, int idx, string& value1, bool * lock_hostgroup) {
int vl = strlen(value1.c_str());
const char *v = value1.c_str();
bool only_digit_chars = true;
@ -517,7 +517,7 @@ bool MySQL_Variables::parse_variable_number(MySQL_Session *sess, int idx, string
return false;
proxy_debug(PROXY_DEBUG_MYSQL_COM, 5, "Changing connection %s to %s\n", mysql_tracked_variables[idx].set_variable_name, value1.c_str());
}
exit_after_SetParse = true;
//exit_after_SetParse = true;
} else {
sess->unable_to_parse_set_statement(lock_hostgroup);
return false;

Loading…
Cancel
Save