MXS-2220 Move most remaining functions inside class

Most of the ones still remaining outside are special cases.
Also, removed locking from status manipulation functions as it
has not been required for quite some time.
This commit is contained in:
Esa Korhonen
2019-01-07 16:02:05 +02:00
parent d5c78eb31f
commit 1c647f3753
13 changed files with 145 additions and 186 deletions

View File

@ -2521,7 +2521,7 @@ static void set_server(DCB* dcb, Server* server, char* bit)
{
unsigned int bitvalue;
if ((bitvalue = server_map_status(bit)) != 0)
if ((bitvalue = SERVER::status_from_string(bit)) != 0)
{
std::string errmsg;
if (!mxs::server_set_status(server, bitvalue, &errmsg))
@ -2547,7 +2547,7 @@ static void clear_server(DCB* dcb, Server* server, char* bit)
{
unsigned int bitvalue;
if ((bitvalue = server_map_status(bit)) != 0)
if ((bitvalue = SERVER::status_from_string(bit)) != 0)
{
std::string errmsg;
if (!mxs::server_clear_status(server, bitvalue, &errmsg))

View File

@ -320,7 +320,7 @@ void exec_set_server(DCB* dcb, MAXINFO_TREE* tree)
if (server)
{
int status = server_map_status(tree->right->value);
int status = SERVER::status_from_string(tree->right->value);
if (status != 0)
{
std::string errmsgs;
@ -407,7 +407,7 @@ void exec_clear_server(DCB* dcb, MAXINFO_TREE* tree)
if (server)
{
int status = server_map_status(tree->right->value);
int status = SERVER::status_from_string(tree->right->value);
if (status != 0)
{
std::string errmsgs;

View File

@ -273,7 +273,7 @@ static void log_server_connections(select_criteria_t criteria, const PRWBackends
b->server->stats.n_current,
b->server->address,
b->server->port,
mxs::server_status(b->server).c_str());
b->server->status_string().c_str());
break;
case LEAST_ROUTER_CONNECTIONS:
@ -281,7 +281,7 @@ static void log_server_connections(select_criteria_t criteria, const PRWBackends
b->connections,
b->server->address,
b->server->port,
mxs::server_status(b->server).c_str());
b->server->status_string().c_str());
break;
case LEAST_CURRENT_OPERATIONS:
@ -289,7 +289,7 @@ static void log_server_connections(select_criteria_t criteria, const PRWBackends
b->server->stats.n_current_ops,
b->server->address,
b->server->port,
mxs::server_status(b->server).c_str());
b->server->status_string().c_str());
break;
case LEAST_BEHIND_MASTER:
@ -297,7 +297,7 @@ static void log_server_connections(select_criteria_t criteria, const PRWBackends
b->server->rlag,
b->server->address,
b->server->port,
mxs::server_status(b->server).c_str());
b->server->status_string().c_str());
break;
case ADAPTIVE_ROUTING:
@ -309,7 +309,7 @@ static void log_server_connections(select_criteria_t criteria, const PRWBackends
os.str().c_str(),
b->server->address,
b->server->port,
mxs::server_status(b->server).c_str());
b->server->status_string().c_str());
}
break;

View File

@ -116,7 +116,7 @@ bool connect_backend_servers(SSRBackendList& backends, MXS_SESSION* session)
b->server->stats.n_current,
b->server->address,
b->server->port,
mxs::server_status(b->server).c_str());
b->server->status_string().c_str());
}
}
/**
@ -170,7 +170,7 @@ bool connect_backend_servers(SSRBackendList& backends, MXS_SESSION* session)
if ((*it)->in_use())
{
MXS_INFO("Connected %s in \t%s:%d",
mxs::server_status(b->server).c_str(),
b->server->status_string().c_str(),
b->server->address,
b->server->port);
}