| From: | Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com> |
|---|---|
| To: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
| Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation |
| Date: | 2026-07-16 05:06:49 |
| Message-ID: | CAFC+b6oRFJzBHdQ-c-opGHWTDFbQ+=YETpN8jauC9RXGHr1U=A@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Hi Masahiko-San,
On Wed, Jul 15, 2026 at 2:33 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
wrote:
>
> + # Let the released backend finish creating its slot: feed running-xacts
> + # records until it reaches a consistent point (poll_query_until re-runs
> the
> + # query, so pg_log_standby_snapshot() is called until the slot is
> created).
> + $primary->poll_query_until(
> + 'postgres', qq[
> +select (pg_log_standby_snapshot() is not null)
> + and exists (select 1 from pg_replication_slots
> + where slot_name = 'slot_stray' and confirmed_flush_lsn
> is not null)
> +]);
>
> I don't think we need to call pg_log_standby_snapshot() until the slot
> is created since the slot creation writes the running-xacts record
> during the slot creation.
>
> ---
> + # Decoding the first slot must not stumble over a stray status-change
> record.
> + my ($decode_rc, $decode_out, $decode_err) = $primary->psql(
> + 'postgres',
> + qq[select count(*) from pg_logical_slot_get_changes('slot_first',
> null, null)],
> + on_error_die => 0);
> + is($decode_rc, 0, "decoding a concurrently-created slot succeeds");
> + unlike(
> + $decode_err,
> + qr/unexpected logical decoding status change/,
> + "no redundant status-change record was decoded");
>
> We can use safe_psql() to check if the query successfully completes.
>
>
makes sense.
> I've made some cosmetic changes to the comment and the new test
> including the above comments. Please review it.
>
LGTM.
--
Thanks :)
Srinath Reddy Sadipiralla
EDB: https://www.enterprisedb.com/
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Nisha Moond | 2026-07-16 05:44:01 | Re: Support EXCEPT for TABLES IN SCHEMA publications |
| Previous Message | Kyotaro Horiguchi | 2026-07-16 04:54:23 | Re: Improve pg_stat_statements scalability |