diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index d42a461..fe511b5 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1749,7 +1749,7 @@ SELECT pid, wait_event_type, wait_event FROM pg_stat_activity WHERE wait_event i integer Priority of this standby server for being chosen as the synchronous standby in a priority-based synchronous replication. - This has no effect in a quorum-based synchronous replication. + This value is NULL if in a quorum-based synchronous replication. sync_state diff --git a/src/backend/replication/walsender.c b/src/backend/replication/walsender.c index dbb10c7..b57244b 100644 --- a/src/backend/replication/walsender.c +++ b/src/backend/replication/walsender.c @@ -3127,7 +3127,15 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS) else values[8] = IntervalPGetDatum(offset_to_interval(applyLag)); - values[9] = Int32GetDatum(priority); + /* + * The priority appers NULL as it is not used in quorum-based + * sync replication. + */ + if (SyncRepConfig && + SyncRepConfig->syncrep_method == SYNC_REP_QUORUM) + nulls[9] = true; + else + values[9] = Int32GetDatum(priority); /* * More easily understood version of standby state. This is purely diff --git a/src/test/recovery/t/007_sync_rep.pl b/src/test/recovery/t/007_sync_rep.pl index e11b428..f29b4db 100644 --- a/src/test/recovery/t/007_sync_rep.pl +++ b/src/test/recovery/t/007_sync_rep.pl @@ -185,9 +185,9 @@ standby4|0|async), # Check that all the listed standbys are considered as candidates # for sync standbys in a quorum-based sync replication. test_sync_state( -$node_master, qq(standby1|1|quorum -standby2|2|quorum -standby4|0|async), +$node_master, qq(standby1||quorum +standby2||quorum +standby4||async), '2 quorum and 1 async', 'ANY 2(standby1, standby2)'); @@ -197,9 +197,9 @@ $node_standby_3->start; # Check that the setting of 'ANY 2(*)' chooses all standbys as # candidates for quorum sync standbys. test_sync_state( -$node_master, qq(standby1|1|quorum -standby2|1|quorum -standby3|1|quorum -standby4|1|quorum), +$node_master, qq(standby1||quorum +standby2||quorum +standby3||quorum +standby4||quorum), 'all standbys are considered as candidates for quorum sync standbys', 'ANY 2(*)');