This topic describes the failover slot feature to synchronize logical slots from a primary instance to a secondary instance.

Background information

The logical subscription will be disabled during a primary/secondary switchover if you do not enable the failover slot feature. This is because slots cannot be automatically switched to the new primary instance. You must manually create slots to enable logical subscription again. The failover slot feature synchronizes logical slots from a primary instance to a secondary instance to ensure that logical subscription is enabled.

Note You can only create failover slots for logical slots.

You can set the rds_failover_slot_mode parameter to use the failover slot feature. The parameter value takes effect immediately. Valid values:

  • sync: enable the synchronization mode.
  • async: enable the asynchronization mode.
  • off: disable the failover slot feature.

For more information about how to set the parameter value, see Reconfigure parameters for an RDS PostgreSQL instance.

The following section describes the two modes in details.

Synchronization mode

Synchronization mode ensures that logical subscription data is not lost after a primary/secondary switchover.

However, when the secondary instance is disconnected for a long time period or the secondary instance is recreated, the latency between the primary and secondary instances is high. If you perform the primary/secondary switchover during this period, logical subscription data may be lost. Lost data includes data lost during the primary/secondary switchover and lost data generated by the new primary instance after the switchover.

To avoid this situation, modify the rds_priority_replication_force_wait parameter to on.The default parameter value is off. The modification takes effect immediately. After you modify the parameter, the primary instance will not send data to the logical subscription client until the secondary instance is reconnected or recreated. We recommend that you do not perform this operation because the logical subscription availability is reduced.

Asynchronization mode

Asynchronization mode ensures that logical subscription data is not lost after a primary/secondary switchover. However, duplicate data may be sent to the logical subscription client.

You can use asynchronization mode if possible data inconsistency does not affect your business. Otherwise, we recommend that you use synchronization mode.