bug/confusion with pg_log_standby_snapshot()

From: "Pete O'Such" <posuch(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: bug/confusion with pg_log_standby_snapshot()
Date: 2024-02-05 04:41:23
Message-ID: CAEdngj-WwWucgRc3uweqrtxR+5fDM2C9vQsTW_tusSZxwY2VPw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Is pg_log_standby_snapshot() expected to cause a WAL segment to be emitted
in an otherwise idle system? In my lab setup, the primary did not, despite
invoking pg_log_standby_snapshot() on it, even when several times the
archive_timeout value passed after using that function.

The setup was all Postgres 16.1, with a primary replicating to standby via
log-shipping, and the standby (trying to) have a logical replication
publication subscribed by a third Postgres server.

In two separate trial runs, long waits happened on an idle system after
invoking pg_log_standby_snapshot(). The function did not result in a new
WAL segment being shipped to the standby, so on the third server the CREATE
SUBSCRIPTION command hung until I eventually restarted the primary. At
that point CREATE SUBSCRIPTION completed and everything began working.

The documentation says:
> If the primary is idle, creating a logical slot on standby may
> take noticeable time. This can be sped up by calling the
> pg_log_standby_snapshot function on the primary.
https://www.postgresql.org/docs/current/logicaldecoding-explanation.html#LOGICALDECODING-REPLICATION-SLOTS

Using the function wasn't enough. Should I have done more to trigger WAL
emission? If so, directly stating that in the documentation would have
helped me, and maybe others.

Thanks, Pete

Browse pgsql-general by date

  From Date Subject
Next Message Devrim Gündüz 2024-02-05 08:47:39 Re: Yum Update nothing provides libarmadillo.so.12()(64bit) needed by gdal36-libs-3.6.4-6PGDG.rhel9.x86_64 from pgdg-common
Previous Message David G. Johnston 2024-02-05 00:48:19 Re: select from composite type