Documentation
¶
Overview ¶
Package infrastructure contains the structs and interfaces needed to manage replication slots
Index ¶
- func Create(ctx context.Context, db *sql.DB, slot ReplicationSlot) error
- func Delete(ctx context.Context, db *sql.DB, slot ReplicationSlot) error
- func IsInRecovery(ctx context.Context, db *sql.DB) (bool, error)
- func ListOrphanedFailoverSlots(ctx context.Context, db *sql.DB) ([]string, error)
- func Update(ctx context.Context, db *sql.DB, slot ReplicationSlot) error
- type ReplicationSlot
- type ReplicationSlotList
- type SlotType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsInRecovery ¶
IsInRecovery reports whether the instance is in recovery
func ListOrphanedFailoverSlots ¶
ListOrphanedFailoverSlots lists the logical failover slots of a standby that are not synced and not in use. PostgreSQL enables failover on a slot during recovery only in the slot sync worker, which marks its slots as synced, so these slots were created while the instance was a primary. The worker errors out instead of overwriting them. It lists nothing when sync_replication_slots is off: there is no worker to unblock, and pg_failover_slots keeps using the slots of a former primary. It requires PostgreSQL 17 or later.
Types ¶
type ReplicationSlot ¶
type ReplicationSlot struct {
SlotName string `json:"slotName,omitempty"`
Type SlotType `json:"type,omitempty"`
Active bool `json:"active"`
RestartLSN string `json:"restartLSN,omitempty"`
IsHA bool `json:"isHA,omitempty"`
HoldsXmin bool `json:"holdsXmin,omitempty"`
}
ReplicationSlot represents a single replication slot
type ReplicationSlotList ¶
type ReplicationSlotList struct {
Items []ReplicationSlot
}
ReplicationSlotList contains a list of replication slots
func List ¶ added in v1.23.6
func List(ctx context.Context, db *sql.DB, config *apiv1.ReplicationSlotsConfiguration) (ReplicationSlotList, error)
List the available replication slots
func (ReplicationSlotList) Get ¶
func (sl ReplicationSlotList) Get(name string) *ReplicationSlot
Get returns the ReplicationSlot with the required name if present in the ReplicationSlotList
func (ReplicationSlotList) Has ¶
func (sl ReplicationSlotList) Has(name string) bool
Has returns true is a ReplicationSlot with the required name if present in the ReplicationSlotList