MXS-1503: Remove redundant code
Moved session command execution into the Backend class itself as the session commands are defined as a related part of it. This allows all connections to execute session commands if some are available. Removed explicit SERVER_REF usage in the readwritesplit connection creation code and replaced it with SRWBackend. This allows the removal of the get_root_master_backend function which duplicated the functionality in get_root_master.
This commit is contained in:
@ -176,7 +176,7 @@ void Backend::set_state(backend_state state)
|
||||
m_state |= state;
|
||||
}
|
||||
|
||||
bool Backend::connect(MXS_SESSION* session)
|
||||
bool Backend::connect(MXS_SESSION* session, SessionCommandList* sescmd)
|
||||
{
|
||||
bool rval = false;
|
||||
|
||||
@ -186,6 +186,16 @@ bool Backend::connect(MXS_SESSION* session)
|
||||
m_state = IN_USE;
|
||||
atomic_add(&m_backend->connections, 1);
|
||||
rval = true;
|
||||
|
||||
if (sescmd && sescmd->size())
|
||||
{
|
||||
append_session_command(*sescmd);
|
||||
|
||||
if (!execute_session_command())
|
||||
{
|
||||
rval = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user