diff options
Diffstat (limited to 'src/backend/replication/walreceiver.c')
-rw-r--r-- | src/backend/replication/walreceiver.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c index b94910bfe9a..faeea9f0cc5 100644 --- a/src/backend/replication/walreceiver.c +++ b/src/backend/replication/walreceiver.c @@ -279,10 +279,13 @@ WalReceiverMain(void) PG_SETMASK(&UnBlockSig); /* Establish the connection to the primary for XLOG streaming */ - wrconn = walrcv_connect(conninfo, false, cluster_name[0] ? cluster_name : "walreceiver", &err); + wrconn = walrcv_connect(conninfo, false, + cluster_name[0] ? cluster_name : "walreceiver", + &err); if (!wrconn) ereport(ERROR, - (errmsg("could not connect to the primary server: %s", err))); + (errcode(ERRCODE_CONNECTION_FAILURE), + errmsg("could not connect to the primary server: %s", err))); /* * Save user-visible connection string. This clobbers the original @@ -328,7 +331,8 @@ WalReceiverMain(void) if (strcmp(primary_sysid, standby_sysid) != 0) { ereport(ERROR, - (errmsg("database system identifier differs between the primary and standby"), + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("database system identifier differs between the primary and standby"), errdetail("The primary's identifier is %s, the standby's identifier is %s.", primary_sysid, standby_sysid))); } @@ -339,7 +343,8 @@ WalReceiverMain(void) */ if (primaryTLI < startpointTLI) ereport(ERROR, - (errmsg("highest timeline %u of the primary is behind recovery timeline %u", + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("highest timeline %u of the primary is behind recovery timeline %u", primaryTLI, startpointTLI))); /* @@ -425,7 +430,8 @@ WalReceiverMain(void) */ if (!RecoveryInProgress()) ereport(FATAL, - (errmsg("cannot continue WAL streaming, recovery has already ended"))); + (errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE), + errmsg("cannot continue WAL streaming, recovery has already ended"))); /* Process any requests or signals received recently */ ProcessWalRcvInterrupts(); @@ -551,7 +557,8 @@ WalReceiverMain(void) if (now >= timeout) ereport(ERROR, - (errmsg("terminating walreceiver due to timeout"))); + (errcode(ERRCODE_CONNECTION_FAILURE), + errmsg("terminating walreceiver due to timeout"))); /* * We didn't receive anything new, for half of |