diff --git a/include/MySQL_Variables.h b/include/MySQL_Variables.h index 64a27a92b..6633ce243 100644 --- a/include/MySQL_Variables.h +++ b/include/MySQL_Variables.h @@ -45,7 +45,7 @@ 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_Session* session); + bool on_connect_to_backend(MySQL_Connection *myconn); }; #endif // #ifndef MYSQL_VARIABLES_H diff --git a/lib/MySQL_Session.cpp b/lib/MySQL_Session.cpp index 20d30ceea..626f17dad 100644 --- a/lib/MySQL_Session.cpp +++ b/lib/MySQL_Session.cpp @@ -2494,7 +2494,7 @@ bool MySQL_Session::handler_again___status_CONNECTING_SERVER(int *_rc) { myds->myconn->send_quit = false; myds->myconn->reusable = false; } - mysql_variables.on_connect_to_backend(this); + mysql_variables.on_connect_to_backend(myds->myconn); NEXT_IMMEDIATE_NEW(st); break; case -1: @@ -6332,7 +6332,7 @@ void MySQL_Session::create_new_session_and_reset_connection(MySQL_Data_Stream *_ mc->async_state_machine = ASYNC_IDLE; // may not be true, but is used to correctly perform error handling new_myds->DSS = STATE_MARIADB_QUERY; thread->register_session_connection_handler(new_sess,true); - mysql_variables.on_connect_to_backend(this); + mysql_variables.on_connect_to_backend(mc); if (new_myds->mypolls==NULL) { thread->mypolls.add(POLLIN|POLLOUT, new_myds->fd, new_myds, thread->curtime); } diff --git a/lib/MySQL_Variables.cpp b/lib/MySQL_Variables.cpp index 074042673..7e55cbf50 100644 --- a/lib/MySQL_Variables.cpp +++ b/lib/MySQL_Variables.cpp @@ -44,15 +44,15 @@ MySQL_Variables::MySQL_Variables() { MySQL_Variables::~MySQL_Variables() {} -bool MySQL_Variables::on_connect_to_backend(MySQL_Session* session) { - if (!session || !session->mybe || !session->mybe->server_myds || !session->mybe->server_myds->myconn) return false; - auto be_version = session->mybe->server_myds->myconn->mysql->server_version; +bool MySQL_Variables::on_connect_to_backend(MySQL_Connection *myconn) { + assert(myconn); + auto be_version = myconn->mysql->server_version; // verify this is not galera cluster // assume galera cluster has two dashes in a version char* first_dash = strstr(be_version, "-"); if (!first_dash || !strstr(first_dash+1, "-")) { - session->mybe->server_myds->myconn->var_absent[SQL_WSREP_SYNC_WAIT] = true; + myconn->var_absent[SQL_WSREP_SYNC_WAIT] = true; } return true;