diff options
| author | Alvaro Herrera | 2020-04-07 22:35:00 +0000 |
|---|---|---|
| committer | Alvaro Herrera | 2020-04-07 22:35:00 +0000 |
| commit | c6550776394e25c1620bc8258427c8f1d448080d (patch) | |
| tree | eb5a62fdc5dcca2911d82af615bac3d36f8cf611 /src/include/replication | |
| parent | b63c293bcbd7439f883cd4cf748f6755df0fbb3c (diff) | |
Allow users to limit storage reserved by replication slots
Replication slots are useful to retain data that may be needed by a
replication system. But experience has shown that allowing them to
retain excessive data can lead to the primary failing because of running
out of space. This new feature allows the user to configure a maximum
amount of space to be reserved using the new option
max_slot_wal_keep_size. Slots that overrun that space are invalidated
at checkpoint time, enabling the storage to be released.
Author: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Reviewed-by: Masahiko Sawada <sawada.mshk@gmail.com>
Reviewed-by: Jehan-Guillaume de Rorthais <jgdr@dalibo.com>
Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org>
Discussion: https://postgr.es/m/20170228.122736.123383594.horiguchi.kyotaro@lab.ntt.co.jp
Diffstat (limited to 'src/include/replication')
| -rw-r--r-- | src/include/replication/slot.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/include/replication/slot.h b/src/include/replication/slot.h index 3e95b019b33..149210bae45 100644 --- a/src/include/replication/slot.h +++ b/src/include/replication/slot.h @@ -36,6 +36,14 @@ typedef enum ReplicationSlotPersistency RS_TEMPORARY } ReplicationSlotPersistency; +/* For ReplicationSlotAcquire, q.v. */ +typedef enum SlotAcquireBehavior +{ + SAB_Error, + SAB_Block, + SAB_Inquire +} SlotAcquireBehavior; + /* * On-Disk data of a replication slot, preserved across restarts. */ @@ -184,7 +192,7 @@ extern void ReplicationSlotCreate(const char *name, bool db_specific, extern void ReplicationSlotPersist(void); extern void ReplicationSlotDrop(const char *name, bool nowait); -extern void ReplicationSlotAcquire(const char *name, bool nowait); +extern int ReplicationSlotAcquire(const char *name, SlotAcquireBehavior behavior); extern void ReplicationSlotRelease(void); extern void ReplicationSlotCleanup(void); extern void ReplicationSlotSave(void); @@ -198,6 +206,7 @@ extern void ReplicationSlotsComputeRequiredLSN(void); extern XLogRecPtr ReplicationSlotsComputeLogicalRestartLSN(void); extern bool ReplicationSlotsCountDBSlots(Oid dboid, int *nslots, int *nactive); extern void ReplicationSlotsDropDBSlots(Oid dboid); +extern void InvalidateObsoleteReplicationSlots(XLogSegNo oldestSegno); extern void StartupReplicationSlots(void); extern void CheckPointReplicationSlots(void); |
