Added checks to verify that backend connection is present in several 'MySQL_Connection::async_' functions

pull/3176/head
Javier Jaramago Fernández 6 years ago
parent e1a1ba4277
commit e40d57d75c

@ -1500,15 +1500,9 @@ int MySQL_Connection::async_query(short event, char *stmt, unsigned long length,
assert(mysql);
assert(ret_mysql);
server_status=parent->status; // we copy it here to avoid race condition. The caller will see this
if (
(server_status==MYSQL_SERVER_STATUS_OFFLINE_HARD) // the server is OFFLINE as specific by the user
||
(server_status==MYSQL_SERVER_STATUS_SHUNNED && parent->shunned_automatic==true && parent->shunned_and_kill_all_connections==true) // the server is SHUNNED due to a serious issue
||
(server_status==MYSQL_SERVER_STATUS_SHUNNED_REPLICATION_LAG) // slave is lagging! see #774
) {
if (IsServerOffline())
return -1;
}
if (myds) {
if (myds->DSS != STATE_MARIADB_QUERY) {
myds->DSS = STATE_MARIADB_QUERY;
@ -1634,6 +1628,10 @@ int MySQL_Connection::async_change_user(short event) {
PROXY_TRACE();
assert(mysql);
assert(ret_mysql);
server_status=parent->status; // we copy it here to avoid race condition. The caller will see this
if (IsServerOffline())
return -1;
switch (async_state_machine) {
case ASYNC_CHANGE_USER_SUCCESSFUL:
unknown_transaction_status = false;
@ -1677,6 +1675,10 @@ int MySQL_Connection::async_select_db(short event) {
PROXY_TRACE();
assert(mysql);
assert(ret_mysql);
server_status=parent->status; // we copy it here to avoid race condition. The caller will see this
if (IsServerOffline())
return -1;
switch (async_state_machine) {
case ASYNC_INITDB_SUCCESSFUL:
unknown_transaction_status = false;
@ -1714,6 +1716,10 @@ int MySQL_Connection::async_set_autocommit(short event, bool ac) {
PROXY_TRACE();
assert(mysql);
assert(ret_mysql);
server_status=parent->status; // we copy it here to avoid race condition. The caller will see this
if (IsServerOffline())
return -1;
switch (async_state_machine) {
case ASYNC_SET_AUTOCOMMIT_SUCCESSFUL:
unknown_transaction_status = false;
@ -1753,6 +1759,10 @@ int MySQL_Connection::async_set_names(short event, unsigned int c) {
PROXY_TRACE();
assert(mysql);
assert(ret_mysql);
server_status=parent->status; // we copy it here to avoid race condition. The caller will see this
if (IsServerOffline())
return -1;
switch (async_state_machine) {
case ASYNC_SET_NAMES_SUCCESSFUL:
unknown_transaction_status = false;
@ -1792,6 +1802,10 @@ int MySQL_Connection::async_set_option(short event, bool mask) {
PROXY_TRACE();
assert(mysql);
assert(ret_mysql);
server_status=parent->status; // we copy it here to avoid race condition. The caller will see this
if (IsServerOffline())
return -1;
switch (async_state_machine) {
case ASYNC_SET_OPTION_SUCCESSFUL:
unknown_transaction_status = false;

Loading…
Cancel
Save