Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation

From: Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
To: Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com>
Cc: shveta malik <shveta(dot)malik(at)gmail(dot)com>, Nisha Moond <nisha(dot)moond412(at)gmail(dot)com>, Nikolay Samokhvalov <nik(at)postgres(dot)ai>, Srinath Reddy Sadipiralla <srinath2133(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fix "unexpected logical decoding status change" error; from concurrent logical decoding activation
Date: 2026-10-08 00:33:43
Message-ID: CAHGQGwFWXASACRnhHJgEdk8nWyLw4bLLDhiEiKSqBqd+tzJ2Pg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Oct 8, 2026 at 4:08 AM Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> wrote:
> Pushed.

The buildfarm member skink reported a failure in the test added by commit
1f2245371e3 [1].

[23:05:02.489](9.575s) not ok 45 - no synced slot is left behind on
standby5 after the re-creation test
[23:05:02.489](0.000s) # Failed test 'no synced slot is left behind
on standby5 after the re-creation test'

The test expects the standby's synced slot to disappear after the
corresponding slot is dropped on the primary. But, in the failed test
case, the test found one slot instead of zero.

The slot can become persistent before the primary drops it. In that case,
WAL replay invalidates the standby slot but does not remove it, leaving one
slot behind. This seems to explain the slot-count failure.

To address this, how about running pg_sync_replication_slots() once more
as follows? This extra sync cycle removes the obsolete slot.

$primary->wait_for_replay_catchup($standby5);
$psql_sync_slot->quit;
+ # The slot may have become sync-ready before it was dropped on the
+ # primary. In that case, replay invalidates it, and a new sync cycle
+ # must remove it from the standby.
+ $standby5->safe_psql('postgres',
+ qq[select pg_sync_replication_slots()]);
$primary->safe_psql('postgres',
qq[select pg_drop_replication_slot('test_slot4')]);
wait_for_logical_decoding_disabled($primary);

Regards,

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=skink&dt=2026-10-07%2019%3A44%3A45

--
Fujii Masao

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chao Li 2026-10-08 00:48:21 Re: [PG19]pg_verifybackup never finishes on a gzip-compressed tar backup
Previous Message Greg Burd 2026-10-08 00:31:55 Re: Comments for lossy ORDER BY are lacking