Cleanup SERVER struct

Removed one unused field. Rearranged others, clarified comments.
This commit is contained in:
Esa Korhonen
2018-04-26 15:29:41 +03:00
parent ba4700a983
commit 5d010ff712
41 changed files with 301 additions and 297 deletions

View File

@ -194,7 +194,7 @@ Dcb HintRouter::connect_to_backend(MXS_SESSION* session, SERVER_REF* sref,
HintRouterSession::BackendMap* all_backends)
{
Dcb result(NULL);
HR_DEBUG("Connecting to %s.", sref->server->unique_name);
HR_DEBUG("Connecting to %s.", sref->server->name);
DCB* new_connection = dcb_connect(sref->server, session, sref->server->protocol);
if (new_connection)
@ -204,7 +204,7 @@ Dcb HintRouter::connect_to_backend(MXS_SESSION* session, SERVER_REF* sref,
new_connection->service = session->service;
result = Dcb(new_connection);
string name(new_connection->server->unique_name);
string name(new_connection->server->name);
all_backends->insert(HintRouterSession::MapElement(name, result));
}
else

View File

@ -42,7 +42,7 @@ public:
if (pPacket)
{
SERVER* pServer = dcb.server();
HR_DEBUG("Writing packet to %p %s.", dcb.get(), pServer ? pServer->unique_name : "(null)");
HR_DEBUG("Writing packet to %p %s.", dcb.get(), pServer ? pServer->name : "(null)");
rv = dcb.write(pPacket);
}
return rv;
@ -137,13 +137,13 @@ void HintRouterSession::clientReply(GWBUF* pPacket, DCB* pBackend)
if (m_surplus_replies == 0)
{
HR_DEBUG("Returning packet from %s.", pServer ? pServer->unique_name : "(null)");
HR_DEBUG("Returning packet from %s.", pServer ? pServer->name : "(null)");
MXS_SESSION_ROUTE_REPLY(pBackend->session, pPacket);
}
else
{
HR_DEBUG("Ignoring reply packet from %s.", pServer ? pServer->unique_name : "(null)");
HR_DEBUG("Ignoring reply packet from %s.", pServer ? pServer->name : "(null)");
--m_surplus_replies;
gwbuf_free(pPacket);
@ -218,7 +218,7 @@ bool HintRouterSession::route_by_hint(GWBUF* pPacket, HINT* hint, bool print_err
if (master_ok)
{
HR_DEBUG("Writing packet to master: '%s'.", m_master.server()->unique_name);
HR_DEBUG("Writing packet to master: '%s'.", m_master.server()->name);
success = m_master.write(pPacket);
if (success)
{
@ -246,7 +246,7 @@ bool HintRouterSession::route_by_hint(GWBUF* pPacket, HINT* hint, bool print_err
BackendMap::const_iterator iter = m_backends.find(backend_name);
if (iter != m_backends.end())
{
HR_DEBUG("Writing packet to %s.", iter->second.server()->unique_name);
HR_DEBUG("Writing packet to %s.", iter->second.server()->name);
success = iter->second.write(pPacket);
if (success)
{
@ -317,7 +317,7 @@ bool HintRouterSession::route_to_slave(GWBUF* pPacket, bool print_errors)
Dcb& candidate = m_slaves.at(curr % size);
if (SERVER_IS_SLAVE(candidate.server()))
{
HR_DEBUG("Writing packet to slave: '%s'.", candidate.server()->unique_name);
HR_DEBUG("Writing packet to slave: '%s'.", candidate.server()->name);
success = candidate.write(pPacket);
if (success)
{
@ -345,7 +345,7 @@ bool HintRouterSession::route_to_slave(GWBUF* pPacket, bool print_errors)
for (size_type curr = begin; curr != limit; curr++)
{
Dcb& candidate = m_slaves.at(curr % size);
HR_DEBUG("Writing packet to slave: '%s'.", candidate.server()->unique_name);
HR_DEBUG("Writing packet to slave: '%s'.", candidate.server()->name);
success = candidate.write(pPacket);
if (success)
{