hapostgres / hapostgres/pg_auto_failover

When replacing a monitor server, candidate priority and replication quorum are reset.

Open
#1,049 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.4k
Forks
142
Avg merge
5h 8m
Merged PRs (30d)
1

Description

#### problem
when replacing a monitor server, candidate priority and replication quorum are reset.
Is it possible to prevent the setting values ​​from being reset when replacing the monitor server?
specific servers should not failover to primary while changing monitors.
ex) The read-replica server must be excluded from being a primary candidate.

#### test case

```

$ pg_autoctl show state
Name | Node | Host:Port | TLI: LSN | Connection | Reported State | Assigned State
------------------+-------+------------------------+-----------------+--------------+---------------------+--------------------
pgdrmu001 | 3 | pgdrmu001:6432 | 3: 0/20000060 | read-write | primary | primary
pgdrmu002 | 4 | pgdrmu002:6432 | 3: 0/20000060 | read-only | secondary | secondary
pgdrmu003 | 12 | pgdrmu003:6432 | 3: 0/20000060 | read-only | secondary | secondary

$ pg_autoctl show settings
Context | Name | Setting | Value
----------+-------------------+---------------------------+-----------------------------------
formation | f1 | number_sync_standbys | 0
primary | pgdrmu001 | synchronous_standby_names | 'ANY 1 (pgautofailover_standby_4)'
node | pgdrmu001 | candidate priority | 50
node | pgdrmu002 | candidate priority | 50
node | pgdrmu003 | candidate priority | 0
node | pgdrmu001 | replication quorum | true
node | pgdrmu002 | replication quorum | true
node | pgdrmu003 | replication quorum | false

#### read-replica => secondary => primary
pg_autoctl disable monitor --force

#### primary => secondary => read-replica
pg_autoctl enable monitor postgres://autoctl_node@pgdrmu010:16432/pg_auto_failover

$ pg_autoctl show state
Name | Node | Host:Port | TLI: LSN | Connection | Reported State | Assigned State
------------------+-------+------------------------+-----------------+--------------+---------------------+--------------------
pgdrmu001 | 3 | pgdrmu001:6432 | 3: 0/200001F8 | read-write | primary | primary
pgdrmu002 | 4 | pgdrmu002:6432 | 3: 0/200001F8 | read-only | secondary | secondary
pgdrmu003 | 12 | pgdrmu003:6432 | 3: 0/20000000 | read-only | secondary | secondary

$ pg_autoctl show settings
Context | Name | Setting | Value
----------+-------------------+---------------------------+--------------------------------------------------------------
formation | f1 | number_sync_standbys | 1
primary | pgdrmu001 | synchronous_standby_names | 'ANY 1 (pgautofailover_standby_4, pgautofailover_standby_12)'
node | pgdrmu001 | candidate priority | 50
node | pgdrmu002 | candidate priority | 50
node | pgdrmu003 | candidate priority | 50 ==> reset value
node | pgdrmu001 | replication quorum | true
node | pgdrmu002 | replication quorum | true
node | pgdrmu003 | replication quorum | true

#### Change the settings to the values ​​before the change
pg_autoctl set formation number-sync-standbys 0 --formation f1
pg_autoctl set node candidate-priority 0 --name dev-pgdrmu003-ncl --formation f1
pg_autoctl set node replication-quorum false --name dev-pgdrmu003-ncl --formation f1
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.