Using replication slots
Replication slots allow you to define your replication architecture explicitly. They also allow you to track the details of nodes even when they are disconnected. Replication slots work with both PSR and LSR, though they operate slightly differently.
Replication slots ensure that data required by a downstream node persists until the node receives it. They are crash-safe, so if a connection is lost, the slot still continues to exist. By tracking data on downstream nodes, we avoid these problems:
- When a standby disconnects, the feedback data provided by
hot_standby_feedback
is lost. When the standby reconnects, it may be sent cleanup records that result in query conflicts. Replication slots remember the standby’sxmin
value even when disconnected, ensuring that cleanup conflicts can be avoided. - When a standby disconnects, knowledge of which WAL files were required is lost. When the standby reconnects, we may have discarded the required...