ApsaraDB RDS for PostgreSQL allows you to view and delete replication slots in the ApsaraDB RDS console or by calling API operations. This way, you can manage WAL logs. WAL is short for write-ahead logging.
Background information
A replication slot is a mechanism in PostgreSQL. It retains the streams of changes that can be replayed in streaming replication. You can use replication slots to prevent data loss or duplicate replication in streaming replication and improve the efficiency and reliability of data replication.
If a large number of inactive replication slots exist and are not deleted at the earliest opportunity, WAL logs are continuously accumulated and consume a large number of storage resources. Accumulated WAL logs may exhaust disk space and cause an RDS instance to be locked. If an RDS instance is locked, the RDS instance cannot process write requests, which affects business.
ApsaraDB RDS for PostgreSQL allows you to delete inactive replication slots in the ApsaraDB RDS console or by calling API operations. This prevents WAL logs from occupying a large amount of disk space.
Usage notes
You cannot delete active replication slots.
If inactive replication slots are not deleted at the earliest opportunity, WAL logs are continuously accumulated and consume a large number of storage resources. If accumulated WAL logs exhaust disk space, an RDS instance becomes locked and cannot process write requests, which affects business.
Impacts
After an inactive replication slot is deleted, the following impacts occur:
WAL logs that cannot be deleted due to the inactive replication slot on an RDS instance are automatically deleted.
The deleted replication slot cannot be reused.
Procedure
Go to the Instances page. In the top navigation bar, select the region in which the RDS instance resides. Then, find the RDS instance and click the ID of the instance.
In the left-side navigation pane of the page that appears, click Logs.
On the WAL File Management tab, view information about all replication slots.
The information about a replication slot maps the fields in the
pg_replication_slots
table in PostgreSQL. The following table describes the mappings.Parameter
Field in the pg_replication_slots table
Description
Slot Name
slot_name
The name of the replication slot.
Slot Type
slot_type
The type of the replication slot. Valid values:
physical
logical
Plugin
plugin
By default, ApsaraDB RDS for PostgreSQL supports the following extensions:
test_decoding
pgoutput
wal2json
Temporary Slot
temporary
Specifies whether the replication slot is a temporary slot. A temporary slot is a special type of slot that exists only during the current session and is automatically deleted after the session ends.
true: temporary slot
false: permanent slot
Database Name
database
The database in which the replication slot resides.
Accumulated WAL Files
No field is mapped.
The parameter is calculated by AliPG.
The number of WAL logs that are accumulated for the replication slot. Unit: MB.
Logical Subscription Latency
No field is mapped.
The parameter is calculated by AliPG.
The latency of the logical subscription on the subscriber node that corresponds to the current replication slot. Unit: seconds.
Whether Active
active
Specifies whether the replication slot is in use. Valid values:
INACTIVE
ACTIVE
Optional. Manage a replication slot for which INACTIVE is displayed in the Whether Active column. You must manage the inactive replication slot at the earliest opportunity because WAL logs are continuously accumulated for the replication slot.
If the replication slot is in use, change the state to ACTIVE.
If the replication slot is not in use, click Delete in the Actions column.
For more information about slots and how to create slots, see the following topics:
Related operations
DescribeSlots: Queries information about all replication slots of an instance.
DeleteSlot: Deletes replication slots from an instance.