Search code examples
postgresqlwal

What does pg_replication_slots.active f for the WAL?


Postgres documentation states the following regarding pg_replication_slots.active: True if this slot is currently actively being used.

What does this actually imply for a false value?

For example, will the WAL still stick around if the value is false? Can I then set to true and it will continue to replicate from where it left off?


Solution

  • From all of my personal exploration it appears that even with an active=False replication slot:

    • The WAL is still pinned and will stick around even if the replication slot is active=False.
    • It's not possible to explicitly set active to True.
    • Deactivation general occurs because the follower had some issue which made it fail to safely read from the WAL, replicate, and move the LSN pointer.
    • Restarting the follower, assuming it then succeeds in safely replicating, will generally fix the issue, and the slot will automatically change to active=True.