mirror of
https://github.com/postgres/postgres.git
synced 2025-11-25 12:03:53 +03:00
Handle logical slot conflicts on standby
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. See6af1793954for 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
This commit is contained in:
@@ -42,6 +42,7 @@ typedef enum
|
||||
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,
|
||||
|
||||
|
||||
@@ -30,8 +30,10 @@ extern void InitRecoveryTransactionEnvironment(void);
|
||||
extern void ShutdownRecoveryTransactionEnvironment(void);
|
||||
|
||||
extern void ResolveRecoveryConflictWithSnapshot(TransactionId snapshotConflictHorizon,
|
||||
bool isCatalogRel,
|
||||
RelFileLocator locator);
|
||||
extern void ResolveRecoveryConflictWithSnapshotFullXid(FullTransactionId snapshotConflictHorizon,
|
||||
bool isCatalogRel,
|
||||
RelFileLocator locator);
|
||||
extern void ResolveRecoveryConflictWithTablespace(Oid tsid);
|
||||
extern void ResolveRecoveryConflictWithDatabase(Oid dbid);
|
||||
|
||||
Reference in New Issue
Block a user