Skip to content

Commit 6a771d1

Browse files
Add connection messages for streaming replication. log_connections
was broken for a replication connection and no messages were displayed on either standby or primary, at any debug level. Connection messages needed to diagnose session drop/reconnect events. Use LOG mode for now, discuss lowering in later releases.
1 parent 75867c5 commit 6a771d1

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

src/backend/replication/libpqwalreceiver/libpqwalreceiver.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
*
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c,v 1.6 2010/03/19 17:51:42 sriggs Exp $
13+
* $PostgreSQL: pgsql/src/backend/replication/libpqwalreceiver/libpqwalreceiver.c,v 1.7 2010/03/19 19:19:38 sriggs Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
@@ -157,6 +157,8 @@ libpqrcv_connect(char *conninfo, XLogRecPtr startpoint)
157157
PQclear(res);
158158

159159
justconnected = true;
160+
ereport(LOG,
161+
(errmsg("streaming replication successfully connected to primary")));
160162

161163
return true;
162164
}

src/backend/utils/init/postinit.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.204 2010/02/26 02:01:13 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/utils/init/postinit.c,v 1.205 2010/03/19 19:19:38 sriggs Exp $
1212
*
1313
*
1414
*-------------------------------------------------------------------------
@@ -217,7 +217,14 @@ PerformAuthentication(Port *port)
217217
if (!disable_sig_alarm(true))
218218
elog(FATAL, "could not disable timer for authorization timeout");
219219

220-
if (Log_connections)
220+
/*
221+
* Log connection for streaming replication even if Log_connections disabled.
222+
*/
223+
if (am_walsender)
224+
ereport(LOG,
225+
(errmsg("connection authorized: user=%s database=replication",
226+
port->user_name)));
227+
else if (Log_connections)
221228
ereport(LOG,
222229
(errmsg("connection authorized: user=%s database=%s",
223230
port->user_name, port->database_name)));

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy