HomeClusterLabs Projects

pgsql: create replication slots after promoting master

Description

pgsql: create replication slots after promoting master

A PostgreSQL instance can be promoted to master either with or without a
restart of the PostgreSQL service. When restart_on_promote=false
creation of replication slots works correctly, but with
restart_on_promote=true the replication slots are created upon promoting
the master (in pgsql_promote()) but they are deleted shortly afterwards
when PostgreSQL is restarted (in pgsql_real_start()).

This results in the slave node failing with an error indicating that it
cannot find the specified replication slot, because, indeed, no such
replication slot exists after it is deleted.

This change fixes that problem by moving the creation of replication
slots to a point in time *after* the PostgreSQL instance has been
promoted to master and thus after the service has been restarted if
restart_on_promote=true.

This will allow the slave to find and connect to the specified
replication slot after master has been promoted.

See thread in
https://github.com/ClusterLabs/resource-agents/pull/956#issuecomment-329899579
for a brief discussion.

Fixes #1056.

Details

Provenance
Andreas Ntaflos <andreas.ntaflos@rise-world.com>Authored on Aug 16 2018, 11:38 AM
Parents
rR5ada2e0e9f63: Merge pull request #1191 from krig/mysql-rm-debuglog
Branches
Unknown
Tags
Unknown

Event Timeline