Log user in the failed connection message

pull/7432/head
Filip Sedlák 2024-01-19 14:21:20 +01:00 committed by Filip Sedlak
parent 14ecebe47c
commit 0e287b1450
2 changed files with 6 additions and 5 deletions

View File

@ -246,6 +246,7 @@ ClearResultsIfReady(MultiConnection *connection)
void
ReportConnectionError(MultiConnection *connection, int elevel)
{
char *userName = connection->user;
char *nodeName = connection->hostname;
int nodePort = connection->port;
PGconn *pgConn = connection->pgConn;
@ -264,15 +265,15 @@ ReportConnectionError(MultiConnection *connection, int elevel)
if (messageDetail)
{
ereport(elevel, (errcode(ERRCODE_CONNECTION_FAILURE),
errmsg("connection to the remote node %s:%d failed with the "
"following error: %s", nodeName, nodePort,
errmsg("connection to the remote node %s@%s:%d failed with the "
"following error: %s", userName, nodeName, nodePort,
messageDetail)));
}
else
{
ereport(elevel, (errcode(ERRCODE_CONNECTION_FAILURE),
errmsg("connection to the remote node %s:%d failed",
nodeName, nodePort)));
errmsg("connection to the remote node %s@%s:%d failed",
userName, nodeName, nodePort)));
}
}

View File

@ -128,7 +128,7 @@ BEGIN;
(1 row)
SELECT count(*) FROM socket_test_table;
ERROR: connection to the remote node localhost:xxxxx failed with the following error: connection not open
ERROR: connection to the remote node postgres@localhost:xxxxx failed with the following error: connection not open
ROLLBACK;
-- repartition joins also can recover
SET citus.enable_repartition_joins TO on;