mirror of
https://github.com/postgres/postgres.git
synced 2025-04-29 13:56:47 +03:00
Improve logical replication connection-failure messages.
These messages mostly said "could not connect to the publisher: %s" which is lacking context. Add some verbiage to indicate which subscription or worker process is failing. Nisha Moond Discussion: https://postgr.es/m/CABdArM7q1=zqL++cYd0hVMg3u_tc0S=0Of=Um-KvDhLony0cSg@mail.gmail.com
This commit is contained in:
parent
a0f1fce80c
commit
0d8bd0a72e
@ -755,7 +755,8 @@ CreateSubscription(ParseState *pstate, CreateSubscriptionStmt *stmt,
|
|||||||
if (!wrconn)
|
if (!wrconn)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
(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();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
@ -888,7 +889,8 @@ AlterSubscription_refresh(Subscription *sub, bool copy_data,
|
|||||||
if (!wrconn)
|
if (!wrconn)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
(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();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
@ -1521,7 +1523,8 @@ AlterSubscription(ParseState *pstate, AlterSubscriptionStmt *stmt,
|
|||||||
if (!wrconn)
|
if (!wrconn)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
(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();
|
PG_TRY();
|
||||||
{
|
{
|
||||||
|
@ -1463,7 +1463,8 @@ ReplSlotSyncWorkerMain(char *startup_data, size_t startup_data_len)
|
|||||||
if (!wrconn)
|
if (!wrconn)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
errcode(ERRCODE_CONNECTION_FAILURE),
|
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.
|
* Register the disconnection callback.
|
||||||
|
@ -1342,7 +1342,8 @@ LogicalRepSyncTableStart(XLogRecPtr *origin_startpos)
|
|||||||
if (LogRepWorkerWalRcvConn == NULL)
|
if (LogRepWorkerWalRcvConn == NULL)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
(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 ||
|
Assert(MyLogicalRepWorker->relstate == SUBREL_STATE_INIT ||
|
||||||
MyLogicalRepWorker->relstate == SUBREL_STATE_DATASYNC ||
|
MyLogicalRepWorker->relstate == SUBREL_STATE_DATASYNC ||
|
||||||
|
@ -4500,7 +4500,8 @@ run_apply_worker()
|
|||||||
if (LogRepWorkerWalRcvConn == NULL)
|
if (LogRepWorkerWalRcvConn == NULL)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
(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
|
* We don't really use the output identify_system for anything but it does
|
||||||
|
@ -898,7 +898,8 @@ pg_sync_replication_slots(PG_FUNCTION_ARGS)
|
|||||||
if (!wrconn)
|
if (!wrconn)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
errcode(ERRCODE_CONNECTION_FAILURE),
|
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);
|
SyncReplicationSlots(wrconn);
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ WalReceiverMain(char *startup_data, size_t startup_data_len)
|
|||||||
char *err;
|
char *err;
|
||||||
char *sender_host = NULL;
|
char *sender_host = NULL;
|
||||||
int sender_port = 0;
|
int sender_port = 0;
|
||||||
|
char *appname;
|
||||||
|
|
||||||
Assert(startup_data_len == 0);
|
Assert(startup_data_len == 0);
|
||||||
|
|
||||||
@ -298,13 +299,13 @@ WalReceiverMain(char *startup_data, size_t startup_data_len)
|
|||||||
sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
|
sigprocmask(SIG_SETMASK, &UnBlockSig, NULL);
|
||||||
|
|
||||||
/* Establish the connection to the primary for XLOG streaming */
|
/* Establish the connection to the primary for XLOG streaming */
|
||||||
wrconn = walrcv_connect(conninfo, true, false, false,
|
appname = cluster_name[0] ? cluster_name : "walreceiver";
|
||||||
cluster_name[0] ? cluster_name : "walreceiver",
|
wrconn = walrcv_connect(conninfo, true, false, false, appname, &err);
|
||||||
&err);
|
|
||||||
if (!wrconn)
|
if (!wrconn)
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
(errcode(ERRCODE_CONNECTION_FAILURE),
|
(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
|
* Save user-visible connection string. This clobbers the original
|
||||||
|
@ -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
|
-- fail, connection string parses, but doesn't work (and does so without
|
||||||
-- connecting, so this is reliable and safe)
|
-- connecting, so this is reliable and safe)
|
||||||
CREATE SUBSCRIPTION regress_testsub5 CONNECTION 'port=-1' PUBLICATION testpub;
|
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
|
-- fail - invalid connection string during ALTER
|
||||||
ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
|
ALTER SUBSCRIPTION regress_testsub CONNECTION 'foobar';
|
||||||
ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string
|
ERROR: invalid connection string syntax: missing "=" after "foobar" in connection info string
|
||||||
|
Loading…
x
Reference in New Issue
Block a user