mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-09-28 00:31:51 +02:00
26669757b6
During WAL replay on the standby, when a conflict with a logical slot is identified, invalidate such slots. There are two sources of conflicts: 1) Using the information added in6af1793954
, logical slots are invalidated if required rows are removed 2) wal_level on the primary server is reduced to below logical Uses the infrastructure introduced in the prior commit. FIXME: add commit reference. Change InvalidatePossiblyObsoleteSlot() to use a recovery conflict to interrupt use of a slot, if called in the startup process. The new recovery conflict is added to pg_stat_database_conflicts, as confl_active_logicalslot. See6af1793954
for an overall design of logical decoding on a standby. Bumps catversion for the addition of the pg_stat_database_conflicts column. Bumps PGSTAT_FILE_FORMAT_ID for the same reason. Author: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> Author: Andres Freund <andres@anarazel.de> Author: Amit Khandekar <amitdkhan.pg@gmail.com> (in an older version) Reviewed-by: "Drouvot, Bertrand" <bertranddrouvot.pg@gmail.com> Reviewed-by: Andres Freund <andres@anarazel.de> Reviewed-by: Robert Haas <robertmhaas@gmail.com> Reviewed-by: Fabrízio de Royes Mello <fabriziomello@gmail.com> Reviewed-by: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com> Reviewed-by: Amit Kapila <amit.kapila16@gmail.com> Reviewed-by: Alvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/20230407075009.igg7be27ha2htkbt@awork3.anarazel.de
74 lines
2.4 KiB
C
74 lines
2.4 KiB
C
/*-------------------------------------------------------------------------
|
|
*
|
|
* procsignal.h
|
|
* Routines for interprocess signaling
|
|
*
|
|
*
|
|
* Portions Copyright (c) 1996-2023, PostgreSQL Global Development Group
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
|
*
|
|
* src/include/storage/procsignal.h
|
|
*
|
|
*-------------------------------------------------------------------------
|
|
*/
|
|
#ifndef PROCSIGNAL_H
|
|
#define PROCSIGNAL_H
|
|
|
|
#include "storage/backendid.h"
|
|
|
|
|
|
/*
|
|
* Reasons for signaling a Postgres child process (a backend or an auxiliary
|
|
* process, like checkpointer). We can cope with concurrent signals for different
|
|
* reasons. However, if the same reason is signaled multiple times in quick
|
|
* succession, the process is likely to observe only one notification of it.
|
|
* This is okay for the present uses.
|
|
*
|
|
* Also, because of race conditions, it's important that all the signals be
|
|
* defined so that no harm is done if a process mistakenly receives one.
|
|
*/
|
|
typedef enum
|
|
{
|
|
PROCSIG_CATCHUP_INTERRUPT, /* sinval catchup interrupt */
|
|
PROCSIG_NOTIFY_INTERRUPT, /* listen/notify interrupt */
|
|
PROCSIG_PARALLEL_MESSAGE, /* message from cooperating parallel backend */
|
|
PROCSIG_WALSND_INIT_STOPPING, /* ask walsenders to prepare for shutdown */
|
|
PROCSIG_BARRIER, /* global barrier interrupt */
|
|
PROCSIG_LOG_MEMORY_CONTEXT, /* ask backend to log the memory contexts */
|
|
PROCSIG_PARALLEL_APPLY_MESSAGE, /* Message from parallel apply workers */
|
|
|
|
/* Recovery conflict reasons */
|
|
PROCSIG_RECOVERY_CONFLICT_DATABASE,
|
|
PROCSIG_RECOVERY_CONFLICT_TABLESPACE,
|
|
PROCSIG_RECOVERY_CONFLICT_LOCK,
|
|
PROCSIG_RECOVERY_CONFLICT_SNAPSHOT,
|
|
PROCSIG_RECOVERY_CONFLICT_LOGICALSLOT,
|
|
PROCSIG_RECOVERY_CONFLICT_BUFFERPIN,
|
|
PROCSIG_RECOVERY_CONFLICT_STARTUP_DEADLOCK,
|
|
|
|
NUM_PROCSIGNALS /* Must be last! */
|
|
} ProcSignalReason;
|
|
|
|
typedef enum
|
|
{
|
|
PROCSIGNAL_BARRIER_SMGRRELEASE /* ask smgr to close files */
|
|
} ProcSignalBarrierType;
|
|
|
|
/*
|
|
* prototypes for functions in procsignal.c
|
|
*/
|
|
extern Size ProcSignalShmemSize(void);
|
|
extern void ProcSignalShmemInit(void);
|
|
|
|
extern void ProcSignalInit(int pss_idx);
|
|
extern int SendProcSignal(pid_t pid, ProcSignalReason reason,
|
|
BackendId backendId);
|
|
|
|
extern uint64 EmitProcSignalBarrier(ProcSignalBarrierType type);
|
|
extern void WaitForProcSignalBarrier(uint64 generation);
|
|
extern void ProcessProcSignalBarrier(void);
|
|
|
|
extern void procsignal_sigusr1_handler(SIGNAL_ARGS);
|
|
|
|
#endif /* PROCSIGNAL_H */
|