pg_auto_failover icon indicating copy to clipboard operation
pg_auto_failover copied to clipboard

ERROR candidate-priority value 10 is not valid. Valid values are integers from 0 to 100 🧐

Open steinbrueckri opened this issue 2 years ago • 2 comments

Hi Folks,

I play around a bit with pg_auto_failover and try to set the candidate-priority for the node db-3 but I always get an error, see below.

postgres@db-monitor:~$ pg_autoctl set node candidate-priority --name db-3 10
09:52:32 66930 ERROR candidate-priority value 10 is not valid. Valid values are integers from 0 to 100.

I'm not sure if I did something wrong or if is this just a bug.

Infos about the System

postgres@db-monitor:~$ pg_autoctl get formation settings
  Context |    Name |                   Setting | Value
----------+---------+---------------------------+-------------------------------------------------------------
formation | default |      number_sync_standbys | 1
  primary |    db-1 | synchronous_standby_names | 'ANY 1 (pgautofailover_standby_2, pgautofailover_standby_3)'
     node |    db-1 |        candidate priority | 50
     node |    db-2 |        candidate priority | 50
     node |    db-3 |        candidate priority | 50
     node |    db-1 |        replication quorum | true
     node |    db-2 |        replication quorum | true
     node |    db-3 |        replication quorum | true

postgres@db-monitor:~$ pg_autoctl show state
Name |  Node |  Host:Port |       TLI: LSN |   Connection |      Reported State |      Assigned State
-----+-------+------------+----------------+--------------+---------------------+--------------------
db-1 |     1 |  db-1:5432 |   1: 0/4020D28 |   read-write |             primary |             primary
db-2 |     2 |  db-2:5432 |   1: 0/4020D28 |    read-only |           secondary |           secondary
db-3 |     3 |  db-3:5432 |   1: 0/4020D28 |    read-only |           secondary |           secondary

postgres@db-monitor:~$  pg_autoctl version
pg_autoctl version 2.0
pg_autoctl extension version 2.0
compiled with PostgreSQL 15.0 (Ubuntu 15.0-2.pgdg22.04+1) on x86_64-pc-linux-gnu, compiled by gcc (Ubuntu 11.2.0-19ubuntu1) 11.2.0, 64-bit
compatible with Postgres 10, 11, 12, 13, and 14

steinbrueckri avatar Oct 13 '23 09:10 steinbrueckri

I was able to reproduce this behaviour when running the command on the monitor node.

When run on the "worker" node, the command works as expected:

$ pg_autoctl set node candidate-priority 10 --pgdata postgres-ha
17:05:40 2514767 INFO  Waiting for the settings to have been applied to the monitor and primary node
17:05:40 2514767 INFO  New state is reported by node 1 [...]

Akkowicz avatar Nov 13 '23 16:11 Akkowicz