public inbox for [email protected]
help / color / mirror / Atom feed[PATCH] Remove PROC_IN_ANALYZE
8+ messages / 4 participants
[nested] [flat]
* [PATCH] Remove PROC_IN_ANALYZE
@ 2020-08-05 22:57 Alvaro Herrera <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: Alvaro Herrera @ 2020-08-05 22:57 UTC (permalink / raw)
---
src/backend/commands/analyze.c | 13 +------------
src/include/storage/proc.h | 3 +--
src/include/storage/procarray.h | 7 -------
3 files changed, 2 insertions(+), 21 deletions(-)
diff --git a/src/backend/commands/analyze.c b/src/backend/commands/analyze.c
index 924ef37c81..e0fa73ba79 100644
--- a/src/backend/commands/analyze.c
+++ b/src/backend/commands/analyze.c
@@ -247,11 +247,8 @@ analyze_rel(Oid relid, RangeVar *relation,
}
/*
- * OK, let's do it. First let other backends know I'm in ANALYZE.
+ * OK, let's do it. First, initialize progress reporting.
*/
- LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
- MyPgXact->vacuumFlags |= PROC_IN_ANALYZE;
- LWLockRelease(ProcArrayLock);
pgstat_progress_start_command(PROGRESS_COMMAND_ANALYZE,
RelationGetRelid(onerel));
@@ -279,14 +276,6 @@ analyze_rel(Oid relid, RangeVar *relation,
relation_close(onerel, NoLock);
pgstat_progress_end_command();
-
- /*
- * Reset my PGXACT flag. Note: we need this here, and not in vacuum_rel,
- * because the vacuum flag is cleared by the end-of-xact code.
- */
- LWLockAcquire(ProcArrayLock, LW_EXCLUSIVE);
- MyPgXact->vacuumFlags &= ~PROC_IN_ANALYZE;
- LWLockRelease(ProcArrayLock);
}
/*
diff --git a/src/include/storage/proc.h b/src/include/storage/proc.h
index b20e2ad4f6..5ceb2494ba 100644
--- a/src/include/storage/proc.h
+++ b/src/include/storage/proc.h
@@ -52,7 +52,6 @@ struct XidCache
*/
#define PROC_IS_AUTOVACUUM 0x01 /* is it an autovac worker? */
#define PROC_IN_VACUUM 0x02 /* currently running lazy vacuum */
-#define PROC_IN_ANALYZE 0x04 /* currently running analyze */
#define PROC_VACUUM_FOR_WRAPAROUND 0x08 /* set by autovac only */
#define PROC_IN_LOGICAL_DECODING 0x10 /* currently doing logical
* decoding outside xact */
@@ -60,7 +59,7 @@ struct XidCache
/* flags reset at EOXact */
#define PROC_VACUUM_STATE_MASK \
- (PROC_IN_VACUUM | PROC_IN_ANALYZE | PROC_VACUUM_FOR_WRAPAROUND)
+ (PROC_IN_VACUUM | PROC_VACUUM_FOR_WRAPAROUND)
/*
* We allow a small number of "weak" relation locks (AccessShareLock,
diff --git a/src/include/storage/procarray.h b/src/include/storage/procarray.h
index a5c7d0c064..01040d76e1 100644
--- a/src/include/storage/procarray.h
+++ b/src/include/storage/procarray.h
@@ -29,8 +29,6 @@
*/
#define PROCARRAY_VACUUM_FLAG 0x02 /* currently running lazy
* vacuum */
-#define PROCARRAY_ANALYZE_FLAG 0x04 /* currently running
- * analyze */
#define PROCARRAY_LOGICAL_DECODING_FLAG 0x10 /* currently doing logical
* decoding outside xact */
@@ -42,7 +40,6 @@
* have no corresponding PROC flag equivalent.
*/
#define PROCARRAY_PROC_FLAGS_MASK (PROCARRAY_VACUUM_FLAG | \
- PROCARRAY_ANALYZE_FLAG | \
PROCARRAY_LOGICAL_DECODING_FLAG)
/* Use the following flags as an input "flags" to GetOldestXmin function */
@@ -50,10 +47,6 @@
#define PROCARRAY_FLAGS_DEFAULT PROCARRAY_LOGICAL_DECODING_FLAG
/* Ignore vacuum backends */
#define PROCARRAY_FLAGS_VACUUM PROCARRAY_FLAGS_DEFAULT | PROCARRAY_VACUUM_FLAG
-/* Ignore analyze backends */
-#define PROCARRAY_FLAGS_ANALYZE PROCARRAY_FLAGS_DEFAULT | PROCARRAY_ANALYZE_FLAG
-/* Ignore both vacuum and analyze backends */
-#define PROCARRAY_FLAGS_VACUUM_ANALYZE PROCARRAY_FLAGS_DEFAULT | PROCARRAY_VACUUM_FLAG | PROCARRAY_ANALYZE_FLAG
extern Size ProcArrayShmemSize(void);
extern void CreateSharedProcArray(void);
--
2.20.1
--Kj7319i9nmIyA2yE--
^ permalink raw reply [nested|flat] 8+ messages in thread
* Add last failed connection error message to pg_stat_wal_receiver
@ 2022-05-02 07:57 Bharath Rupireddy <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Bharath Rupireddy @ 2022-05-02 07:57 UTC (permalink / raw)
To: PostgreSQL Hackers <[email protected]>
Hi,
In production environments WAL receiver connection attempts to primary
may fail for many reasons (primary down, network is broken,
authentication tokens changes, primary_conn_info modifications, socket
errors and so on.). Although we emit the error message to server logs,
isn't it useful to show the last connection error message via
pg_stat_wal_receiver or pg_stat_get_wal_receiver? This will be super
helpful in production environments to analyse what the WAL receiver
issues as accessing and sifting through server logs can be quite
cumbersome for the end users.
Thoughts?
Attached patch can only display the last_conn_error only after the WAL
receiver is up, but it will be good to let pg_stat_wal_receiver emit
last_conn_error even before that. Imagine WAL receiver is continuously
failing on the standby, if we let pg_stat_wal_receiver report
last_conn_error, all other columns will show NULL. I can change this
way, if others are okay with it.
Regards,
Bharath Rupireddy.
Attachments:
[application/octet-stream] v1-0001-Add-last-failed-connection-error-message-to-pg_st.patch (7.9K, ../../CALj2ACWt6wkFnu7sac3pUb4WLZ3jA1m3cu7FJE3EovpGKzhwKw@mail.gmail.com/2-v1-0001-Add-last-failed-connection-error-message-to-pg_st.patch)
download | inline diff:
From f5aadf23829b9c8380b8f5912eacbe90b3c7ccd4 Mon Sep 17 00:00:00 2001
From: Bharath Rupireddy <[email protected]>
Date: Mon, 2 May 2022 07:53:57 +0000
Subject: [PATCH v1] Add last failed connection error message to
pg_stat_wal_receiver
In production environments WAL receiver connection attempts to
primary may fail for many reasons (primary down, network is broken,
authentication tokens changes, primary_conn_info modifications,
socket errors and so on.). Although we emit the error message to
server logs, isn't it useful to show the last connection error
message via pg_stat_wal_receiver or pg_stat_get_wal_receiver? This
will be super helpful in production environments to analyse what
the WAL receiver issues as accessing and sifting through server
logs can be quite cumbersome for the end users.
---
doc/src/sgml/monitoring.sgml | 11 +++++++++++
src/backend/catalog/system_views.sql | 3 ++-
src/backend/replication/walreceiver.c | 19 +++++++++++++++++++
src/include/catalog/pg_proc.dat | 6 +++---
src/include/replication/walreceiver.h | 12 ++++++++++++
src/test/regress/expected/rules.out | 5 +++--
6 files changed, 50 insertions(+), 6 deletions(-)
diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml
index 56d9b375ec..6098efc6ee 100644
--- a/doc/src/sgml/monitoring.sgml
+++ b/doc/src/sgml/monitoring.sgml
@@ -2972,6 +2972,17 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i
with security-sensitive fields obfuscated.
</para></entry>
</row>
+
+ <row>
+ <entry role="catalog_table_entry"><para role="column_definition">
+ <structfield>last_conn_error</structfield> <type>text</type>
+ </para>
+ <para>
+ Contains last failed connection error message of this WAL receiver while
+ connecting to primary. Contains NULL, if no failed connection attempts
+ at all.
+ </para></entry>
+ </row>
</tbody>
</tgroup>
</table>
diff --git a/src/backend/catalog/system_views.sql b/src/backend/catalog/system_views.sql
index 0fc614e32c..876ff386de 100644
--- a/src/backend/catalog/system_views.sql
+++ b/src/backend/catalog/system_views.sql
@@ -916,7 +916,8 @@ CREATE VIEW pg_stat_wal_receiver AS
s.slot_name,
s.sender_host,
s.sender_port,
- s.conninfo
+ s.conninfo,
+ s.last_conn_error
FROM pg_stat_get_wal_receiver() s
WHERE s.pid IS NOT NULL;
diff --git a/src/backend/replication/walreceiver.c b/src/backend/replication/walreceiver.c
index 3c9411e221..35524943cb 100644
--- a/src/backend/replication/walreceiver.c
+++ b/src/backend/replication/walreceiver.c
@@ -287,9 +287,22 @@ WalReceiverMain(void)
cluster_name[0] ? cluster_name : "walreceiver",
&err);
if (!wrconn)
+ {
+ /*
+ * Place the error message into WAL receiver shared memory so that it
+ * is easily accessible by the users via WAL receiver stats function.
+ *
+ * Can the error message ever be more than MAXCONNERRORLENGTH bytes?
+ * Most of the common error messages that libpq emits aren't of that
+ * huge, but if there's any such error message crossing
+ * MAXCONNERRORLENGTH bytes, it's okay to truncate and store.
+ */
+ strlcpy(WalRcv->last_conn_error, err, MAXCONNERRORLENGTH);
+
ereport(ERROR,
(errcode(ERRCODE_CONNECTION_FAILURE),
errmsg("could not connect to the primary server: %s", err)));
+ }
/*
* Save user-visible connection string. This clobbers the original
@@ -1358,6 +1371,7 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
int sender_port = 0;
char slotname[NAMEDATALEN];
char conninfo[MAXCONNINFO];
+ char last_conn_error[MAXCONNERRORLENGTH];
/* Take a lock to ensure value consistency */
SpinLockAcquire(&WalRcv->mutex);
@@ -1376,6 +1390,7 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
strlcpy(sender_host, (char *) WalRcv->sender_host, sizeof(sender_host));
sender_port = WalRcv->sender_port;
strlcpy(conninfo, (char *) WalRcv->conninfo, sizeof(conninfo));
+ strlcpy(last_conn_error, (char *) WalRcv->last_conn_error, sizeof(last_conn_error));
SpinLockRelease(&WalRcv->mutex);
/*
@@ -1462,6 +1477,10 @@ pg_stat_get_wal_receiver(PG_FUNCTION_ARGS)
nulls[14] = true;
else
values[14] = CStringGetTextDatum(conninfo);
+ if (*last_conn_error == '\0')
+ nulls[15] = true;
+ else
+ values[15] = CStringGetTextDatum(last_conn_error);
}
/* Returns the record as Datum */
diff --git a/src/include/catalog/pg_proc.dat b/src/include/catalog/pg_proc.dat
index 6d378ff785..19dc0ef411 100644
--- a/src/include/catalog/pg_proc.dat
+++ b/src/include/catalog/pg_proc.dat
@@ -5365,9 +5365,9 @@
{ oid => '3317', descr => 'statistics: information about WAL receiver',
proname => 'pg_stat_get_wal_receiver', proisstrict => 'f', provolatile => 's',
proparallel => 'r', prorettype => 'record', proargtypes => '',
- proallargtypes => '{int4,text,pg_lsn,int4,pg_lsn,pg_lsn,int4,timestamptz,timestamptz,pg_lsn,timestamptz,text,text,int4,text}',
- proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
- proargnames => '{pid,status,receive_start_lsn,receive_start_tli,written_lsn,flushed_lsn,received_tli,last_msg_send_time,last_msg_receipt_time,latest_end_lsn,latest_end_time,slot_name,sender_host,sender_port,conninfo}',
+ proallargtypes => '{int4,text,pg_lsn,int4,pg_lsn,pg_lsn,int4,timestamptz,timestamptz,pg_lsn,timestamptz,text,text,int4,text,text}',
+ proargmodes => '{o,o,o,o,o,o,o,o,o,o,o,o,o,o,o,o}',
+ proargnames => '{pid,status,receive_start_lsn,receive_start_tli,written_lsn,flushed_lsn,received_tli,last_msg_send_time,last_msg_receipt_time,latest_end_lsn,latest_end_time,slot_name,sender_host,sender_port,conninfo,last_conn_error}',
prosrc => 'pg_stat_get_wal_receiver' },
{ oid => '6169', descr => 'statistics: information about replication slot',
proname => 'pg_stat_get_replication_slot', provolatile => 's',
diff --git a/src/include/replication/walreceiver.h b/src/include/replication/walreceiver.h
index 81184aa92f..c31a5d76af 100644
--- a/src/include/replication/walreceiver.h
+++ b/src/include/replication/walreceiver.h
@@ -36,6 +36,11 @@ extern PGDLLIMPORT bool hot_standby_feedback;
*/
#define MAXCONNINFO 1024
+/*
+ * MAXCONNERRORLENGTH: maximum size of a connection error.
+ */
+#define MAXCONNERRORLENGTH 1024
+
/* Can we allow the standby to accept replication connection from another standby? */
#define AllowCascadeReplication() (EnableHotStandby && max_wal_senders > 0)
@@ -158,6 +163,13 @@ typedef struct
* store semantics, so use sig_atomic_t.
*/
sig_atomic_t force_reply; /* used as a bool */
+
+ /*
+ * WAL receiver connection attempt to primary may fail at times. Contains
+ * NULL if no failed connection attempts at all, otherwise contains error
+ * message (truncated to MAXCONNERRORLENGTH) of last failed attempt.
+ */
+ char last_conn_error[MAXCONNERRORLENGTH];
} WalRcvData;
extern PGDLLIMPORT WalRcvData *WalRcv;
diff --git a/src/test/regress/expected/rules.out b/src/test/regress/expected/rules.out
index 21effe8315..9b1484d32a 100644
--- a/src/test/regress/expected/rules.out
+++ b/src/test/regress/expected/rules.out
@@ -2199,8 +2199,9 @@ pg_stat_wal_receiver| SELECT s.pid,
s.slot_name,
s.sender_host,
s.sender_port,
- s.conninfo
- FROM pg_stat_get_wal_receiver() s(pid, status, receive_start_lsn, receive_start_tli, written_lsn, flushed_lsn, received_tli, last_msg_send_time, last_msg_receipt_time, latest_end_lsn, latest_end_time, slot_name, sender_host, sender_port, conninfo)
+ s.conninfo,
+ s.last_conn_error
+ FROM pg_stat_get_wal_receiver() s(pid, status, receive_start_lsn, receive_start_tli, written_lsn, flushed_lsn, received_tli, last_msg_send_time, last_msg_receipt_time, latest_end_lsn, latest_end_time, slot_name, sender_host, sender_port, conninfo, last_conn_error)
WHERE (s.pid IS NOT NULL);
pg_stat_xact_all_tables| SELECT c.oid AS relid,
n.nspname AS schemaname,
--
2.25.1
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Add last failed connection error message to pg_stat_wal_receiver
@ 2022-07-22 20:58 Cary Huang <[email protected]>
parent: Bharath Rupireddy <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Cary Huang @ 2022-07-22 20:58 UTC (permalink / raw)
To: [email protected]; +Cc: Bharath Rupireddy <[email protected]>
The following review has been posted through the commitfest application:
make installcheck-world: tested, passed
Implements feature: tested, passed
Spec compliant: tested, passed
Documentation: tested, passed
Hello
The patch can be applied to PG master branch without problem and it passed regression and tap tests. I manually tested this feature too and the last conn error is correctly shown in the pg_stat_get_wal_receiver output, which does exactly as described. I think this feature is nice to have to troubleshoot replication issues on the standby side.
thank you
Cary Huang
----------------
Highgo Software Canada
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Add last failed connection error message to pg_stat_wal_receiver
@ 2022-07-25 06:49 Bharath Rupireddy <[email protected]>
parent: Cary Huang <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Bharath Rupireddy @ 2022-07-25 06:49 UTC (permalink / raw)
To: Cary Huang <[email protected]>; +Cc: PostgreSQL Hackers <[email protected]>
On Sat, Jul 23, 2022 at 2:29 AM Cary Huang <[email protected]> wrote:
>
> The following review has been posted through the commitfest application:
> make installcheck-world: tested, passed
> Implements feature: tested, passed
> Spec compliant: tested, passed
> Documentation: tested, passed
>
> Hello
>
> The patch can be applied to PG master branch without problem and it passed regression and tap tests. I manually tested this feature too and the last conn error is correctly shown in the pg_stat_get_wal_receiver output, which does exactly as described. I think this feature is nice to have to troubleshoot replication issues on the standby side.
Thanks a lot Cary for reviewing. It will be great if you can add
yourself as a reviewer and set the status accordingly in the CF entry
here - https://commitfest.postgresql.org/38/3666/.
Regards,
Bharath Rupireddy.
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Add last failed connection error message to pg_stat_wal_receiver
@ 2022-07-25 09:10 Michael Paquier <[email protected]>
parent: Bharath Rupireddy <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2022-07-25 09:10 UTC (permalink / raw)
To: Bharath Rupireddy <[email protected]>; +Cc: Cary Huang <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Jul 25, 2022 at 12:19:40PM +0530, Bharath Rupireddy wrote:
> Thanks a lot Cary for reviewing. It will be great if you can add
> yourself as a reviewer and set the status accordingly in the CF entry
> here - https://commitfest.postgresql.org/38/3666/.
Hmm. This stands for the connection error, but there are other things
that could cause a failure down the road, like an incorrect system
ID or a TLI-related report, so that seems a bit limited to me?
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Add last failed connection error message to pg_stat_wal_receiver
@ 2022-08-04 09:57 Bharath Rupireddy <[email protected]>
parent: Michael Paquier <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Bharath Rupireddy @ 2022-08-04 09:57 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Cary Huang <[email protected]>; PostgreSQL Hackers <[email protected]>
On Mon, Jul 25, 2022 at 2:40 PM Michael Paquier <[email protected]> wrote:
>
> On Mon, Jul 25, 2022 at 12:19:40PM +0530, Bharath Rupireddy wrote:
> > Thanks a lot Cary for reviewing. It will be great if you can add
> > yourself as a reviewer and set the status accordingly in the CF entry
> > here - https://commitfest.postgresql.org/38/3666/.
>
> Hmm. This stands for the connection error, but there are other things
> that could cause a failure down the road, like an incorrect system
> ID or a TLI-related report, so that seems a bit limited to me?
Good point. The walreceiver can exit for any reason. We can either 1)
store for all the error messages or 2) think of using sigsetjmp but
that only catches the ERROR kinds, leaving FATAL and PANIC messages.
The option (1) is simple but there are problems - we may miss storing
future error messages, good commenting and reviewing may help here and
all the error messages now need to be stored in string, which is
complex. The option (2) seems reasonable but we will miss FATAL and
PANIC messages (we have many ERRORs, 2 FATALs, 3 PANICs). Maybe a
combination of option (1) for FATALs and PANICs, and option (2) for
ERRORs helps.
Thoughts?
--
Bharath Rupireddy
RDS Open Source Databases: https://aws.amazon.com/rds/postgresql/
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Add last failed connection error message to pg_stat_wal_receiver
@ 2022-08-18 03:31 Michael Paquier <[email protected]>
parent: Bharath Rupireddy <[email protected]>
0 siblings, 1 reply; 8+ messages in thread
From: Michael Paquier @ 2022-08-18 03:31 UTC (permalink / raw)
To: Bharath Rupireddy <[email protected]>; +Cc: Cary Huang <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Aug 04, 2022 at 03:27:11PM +0530, Bharath Rupireddy wrote:
> Good point. The walreceiver can exit for any reason. We can either 1)
> store for all the error messages or 2) think of using sigsetjmp but
> that only catches the ERROR kinds, leaving FATAL and PANIC messages.
> The option (1) is simple but there are problems - we may miss storing
> future error messages, good commenting and reviewing may help here and
> all the error messages now need to be stored in string, which is
> complex. The option (2) seems reasonable but we will miss FATAL and
> PANIC messages (we have many ERRORs, 2 FATALs, 3 PANICs). Maybe a
> combination of option (1) for FATALs and PANICs, and option (2) for
> ERRORs helps.
>
> Thoughts?
PANIC is not something you'd care about as the system would go down as
and shared memory would be reset (right?) even if restart_on_crash is
enabled. Perhaps it would help here to use something like a macro to
catch and save the error, in a style similar to what's in hba.c for
example, which is the closest example I can think of, even if on ERROR
we don't really care about the error string anyway as there is nothing
to report back to the SQL views used for the HBA/ident files.
FATAL may prove to be tricky though, because I'd expect the error to
be saved in shared memory in this case. This is particularly critical
as this takes the WAL receiver process down, actually.
Anyway, outside the potential scope of the proposal, there are more
things that I find strange with the code:
- Why isn't the string reset when the WAL receiver is starting up?
That surely is not OK to keep a past state not referring to what
actually happens with a receiver currently running.
- pg_stat_wal_receiver (system view) reports no rows if pid is NULL,
which would be the state stored in shared memory after a connection.
This means that one would never be able to see last_conn_error except
when calling directly the SQL function pg_stat_get_wal_receiver().
One could say that we should report a row for this view all the time,
but this creates a compatibility breakage: existing application
assuming something like (one row <=> WAL receiver running) could
break.
--
Michael
Attachments:
[application/pgp-signature] signature.asc (833B, ../../Yv2ydB%2F7bLUEY%[email protected]/2-signature.asc)
download
^ permalink raw reply [nested|flat] 8+ messages in thread
* Re: Add last failed connection error message to pg_stat_wal_receiver
@ 2022-10-06 06:06 Bharath Rupireddy <[email protected]>
parent: Michael Paquier <[email protected]>
0 siblings, 0 replies; 8+ messages in thread
From: Bharath Rupireddy @ 2022-10-06 06:06 UTC (permalink / raw)
To: Michael Paquier <[email protected]>; +Cc: Cary Huang <[email protected]>; PostgreSQL Hackers <[email protected]>
On Thu, Aug 18, 2022 at 9:01 AM Michael Paquier <[email protected]> wrote:
>
> PANIC is not something you'd care about as the system would go down as
> and shared memory would be reset (right?) even if restart_on_crash is
> enabled. Perhaps it would help here to use something like a macro to
> catch and save the error, in a style similar to what's in hba.c for
> example, which is the closest example I can think of, even if on ERROR
> we don't really care about the error string anyway as there is nothing
> to report back to the SQL views used for the HBA/ident files.
>
> FATAL may prove to be tricky though, because I'd expect the error to
> be saved in shared memory in this case. This is particularly critical
> as this takes the WAL receiver process down, actually.
Hm, we can use error callbacks or pg try/catch blocks to save the
error message into walreceiver shared memory.
> Anyway, outside the potential scope of the proposal, there are more
> things that I find strange with the code:
> - Why isn't the string reset when the WAL receiver is starting up?
> That surely is not OK to keep a past state not referring to what
> actually happens with a receiver currently running.
I agree that it's not a good way to show some past failure state when
things are fine currently. Would naming the column name as
last_connectivity_error or something better and describing it in the
docs clearly help here?
Otherwise, we can have another simple function that just returns the
last connection failure of walreceiver and if required PID.
> - pg_stat_wal_receiver (system view) reports no rows if pid is NULL,
> which would be the state stored in shared memory after a connection.
> This means that one would never be able to see last_conn_error except
> when calling directly the SQL function pg_stat_get_wal_receiver().
>
> One could say that we should report a row for this view all the time,
> but this creates a compatibility breakage: existing application
> assuming something like (one row <=> WAL receiver running) could
> break.
-1.
We can think of having a separate infrastructure for reporting all
backend or process specific errors similar to pg_stat_activity and
pg_stat_get_activity, but that needs some shared memory and all of
that - IMO, it's an overkill.
I'm fine to withdraw this thread, if none of the above thoughts is
sensible enough to pursue further.
Thoughts?
--
Bharath Rupireddy
PostgreSQL Contributors Team
RDS Open Source Databases
Amazon Web Services: https://aws.amazon.com
^ permalink raw reply [nested|flat] 8+ messages in thread
end of thread, other threads:[~2022-10-06 06:06 UTC | newest]
Thread overview: 8+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2020-08-05 22:57 [PATCH] Remove PROC_IN_ANALYZE Alvaro Herrera <[email protected]>
2022-05-02 07:57 Add last failed connection error message to pg_stat_wal_receiver Bharath Rupireddy <[email protected]>
2022-07-22 20:58 ` Re: Add last failed connection error message to pg_stat_wal_receiver Cary Huang <[email protected]>
2022-07-25 06:49 ` Re: Add last failed connection error message to pg_stat_wal_receiver Bharath Rupireddy <[email protected]>
2022-07-25 09:10 ` Re: Add last failed connection error message to pg_stat_wal_receiver Michael Paquier <[email protected]>
2022-08-04 09:57 ` Re: Add last failed connection error message to pg_stat_wal_receiver Bharath Rupireddy <[email protected]>
2022-08-18 03:31 ` Re: Add last failed connection error message to pg_stat_wal_receiver Michael Paquier <[email protected]>
2022-10-06 06:06 ` Re: Add last failed connection error message to pg_stat_wal_receiver Bharath Rupireddy <[email protected]>
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox