aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/commands/subscriptioncmds.c9
-rw-r--r--src/backend/replication/logical/slotsync.c3
-rw-r--r--src/backend/replication/logical/tablesync.c3
-rw-r--r--src/backend/replication/logical/worker.c3
-rw-r--r--src/backend/replication/slotfuncs.c3
-rw-r--r--src/backend/replication/walreceiver.c9
-rw-r--r--src/test/regress/expected/subscription.out2
7 files changed, 20 insertions, 12 deletions
diff --git a/src/backend/commands/subscriptioncmds.c b/src/backend/commands/subscriptioncmds.c
index e407428dbcf..16d83b32539 100644
--- a/src/backend/commands/subscriptioncmds.c
+++ b/src/backend/commands/subscriptioncmds.c
@@ -755,7 +755,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
if (!wrconn)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the publisher: %s", err)));
+ errmsg("subscription \"%s\" could not connect to the publisher: %s",
+ stmt->subname, err)));
PG_TRY();
{
@@ -888,7 +889,8 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data,
if (!wrconn)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the publisher: %s", err)));
+ errmsg("subscription \"%s\" could not connect to the publisher: %s",
+ sub->name, err)));
PG_TRY();
{
@@ -1521,7 +1523,8 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
if (!wrconn)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the publisher: %s", err)));
+ errmsg("subscription \"%s\" could not connect to the publisher: %s",
+ sub->name, err)));
PG_TRY();
{
diff --git a/src/backend/replication/logical/slotsync.c b/src/backend/replication/logical/slotsync.c
index fe2f07cf449..2d1914ce085 100644
--- a/src/backend/replication/logical/slotsync.c
+++ b/src/backend/replication/logical/slotsync.c
@@ -1463,7 +1463,8 @@ ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len)
if (!wrconn)
ereport(ERROR,
errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the primary server: %s", err));
+ errmsg("synchronization worker \"%s\" could not connect to the primary server: %s",
+ app_name.data, err));
/*
* Register the disconnection callback.
diff --git a/src/backend/replication/logical/tablesync.c b/src/backend/replication/logical/tablesync.c
index b00267f0427..e03e7613926 100644
--- a/src/backend/replication/logical/tablesync.c
+++ b/src/backend/replication/logical/tablesync.c
@@ -1342,7 +1342,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
if (LogRepWorkerWalRcvConn == NULL)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the publisher: %s", err)));
+ errmsg("table synchronization worker for subscription \"%s\" could not connect to the publisher: %s",
+ MySubscription->name, err)));
Assert(MyLogicalRepWorker->relstate == SUBREL_STATE_INIT ||
MyLogicalRepWorker->relstate == SUBREL_STATE_DATASYNC ||
diff --git a/src/backend/replication/logical/worker.c b/src/backend/replication/logical/worker.c
index 3b285894dbe..c0bda6269bd 100644
--- a/src/backend/replication/logical/worker.c
+++ b/src/backend/replication/logical/worker.c
@@ -4500,7 +4500,8 @@ run_apply_worker()
if (LogRepWorkerWalRcvConn == NULL)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the publisher: %s", err)));
+ errmsg("apply worker for subscription \"%s\" could not connect to the publisher: %s",
+ MySubscription->name, err)));
/*
* We don't really use the output identify_system for anything but it does
diff --git a/src/backend/replication/slotfuncs.c b/src/backend/replication/slotfuncs.c
index 38595b3a472..c7bfbb15e0a 100644
--- a/src/backend/replication/slotfuncs.c
+++ b/src/backend/replication/slotfuncs.c
@@ -898,7 +898,8 @@ pg_sync_replication_slots(PG_FUNCTION_ARGS)
if (!wrconn)
ereport(ERROR,
errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the primary server: %s", err));
+ errmsg("synchronization worker \"%s\" could not connect to the primary server: %s",
+ app_name.data, err));
SyncReplicationSlots(wrconn);
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index acda5f68d9a..a27aee63def 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -195,6 +195,7 @@ WalReceiverMain(char *startup_data, size_t startup_data_len)
char *err;
char *sender_host = NULL;
int sender_port = 0;
+ char *appname;
Assert(startup_data_len == 0);
@@ -298,13 +299,13 @@ WalReceiverMain(char *startup_data, size_t startup_data_len)
sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
/* Establish the connection to the primary for XLOG streaming */
- wrconn = walrcv_connect(conninfo, true, false, false,
- cluster_name[0] ? cluster_name : "walreceiver",
- &err);
+ appname = cluster_name[0] ? cluster_name : "walreceiver";
+ wrconn = walrcv_connect(conninfo, true, false, false, appname, &err);
if (!wrconn)
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
- errmsg("could not connect to the primary server: %s", err)));
+ errmsg("streaming replication receiver \"%s\" could not connect to the primary server: %s",
+ appname, err)));
/*
* Save user-visible connection string. This clobbers the original
diff --git a/src/test/regress/expected/subscription.out b/src/test/regress/expected/subscription.out
index 0f2a25cdc19..5c2f1ee5171 100644
--- a/src/test/regress/expected/subscription.out
+++ b/src/test/regress/expected/subscription.out
@@ -139,7 +139,7 @@ ERROR: invalid connection string syntax: invalid connection option "i_dont_exis
-- fail, connection string parses, but doesn't work (and does so without
-- connecting, so this is reliable and safe)
CREATE SUBSCRIPTION regress_testsub5 CONNECTION 'port=-1' PUBLICATION testpub;
-ERROR: could not connect to the publisher: invalid port number: "-1"
+ERROR: subscription "regress_testsub5" could not connect to the publisher: invalid port number: "-1"
-- fail - invalid connection string during ALTER
ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string