Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Log server name in error message
This makes it clear which server failed.
  • Loading branch information
markus456 committed Oct 29, 2020
1 parent 11368e5 commit 87f97a1
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc
Expand Up @@ -68,8 +68,8 @@ struct AddressInfo
};
static AddressInfo get_ip_string_and_port(const sockaddr_storage* sa);
static bool gw_connection_established(DCB* dcb);
static bool gw_auth_is_complete(DCB* dcb);
json_t* gw_json_diagnostics(DCB* dcb);
static bool gw_auth_is_complete(DCB* dcb);
json_t* gw_json_diagnostics(DCB* dcb);

extern "C"
{
Expand Down Expand Up @@ -604,16 +604,20 @@ static std::string get_detailed_error(DCB* dcb)
{
std::ostringstream ss;

ss << " (" << dcb->server->name();

if (int err = gw_getsockerrno(dcb->fd))
{
ss << " (" << err << ", " << mxs_strerror(err) << ")";
ss << ": " << err << ", " << mxs_strerror(err);
}
else if (dcb->is_fake_event)
{
// Fake events should not have TCP socket errors
ss << " (Generated event)";
ss << ": Generated event";
}

ss << ")";

return ss.str();
}

Expand Down

0 comments on commit 87f97a1

Please sign in to comment.