By default, logical replication slots created on a primary ApsaraDB RDS for PostgreSQL instance are not synchronized to the secondary instance under the streaming replication protocol. During a primary/secondary switchover, slots are lost and logical subscriptions are interrupted. Logical Replication Slot Failover solves this by continuously synchronizing all logical replication slots from the primary instance to the secondary instance, so subscriptions survive a switchover without manual intervention.
Prerequisites
Before you begin, make sure that:
The RDS instance runs PostgreSQL 10 or later
The Logical Replication Slot Failover feature is supported on the minor engine version. If not, update the minor engine version
How it works
Logical Replication Slot Failover is enabled by default on all ApsaraDB RDS for PostgreSQL instances that meet the version requirements. In async mode, the primary instance asynchronously replicates slot state to the secondary instance. When a primary/secondary switchover occurs, the secondary instance already holds an up-to-date copy of all logical replication slots, so logical subscriptions continue without manual intervention.
Logical Replication Slot Failover applies only to logical replication slots. Physical replication slots are not supported. For background on logical replication slots, see Logical Decoding Concepts.
Check the feature status
Run the following SQL statement to check whether Logical Replication Slot Failover is enabled:
SHOW rds_failover_slot_mode;The following result indicates the feature is enabled:
rds_failover_slot_mode
------------------------
async
(1 row)The possible return values are:
| Value | Meaning |
|---|---|
| async | Logical Replication Slot Failover is enabled. |
| off | The feature is supported on this instance but is currently disabled. |
| ERROR: unrecognized configuration parameter "rds_failover_slot_mode" | The feature is not supported. Upgrade the major engine version or update the minor engine version to meet the prerequisites. |
If the feature is not supported, upgrade the major engine version to a supported version, or update the minor engine version to meet the requirements.