Re: Catalog_xmin is not advanced when a logical slot is lost - Mailing list pgsql-hackers

From sirisha chamarthi
Subject Re: Catalog_xmin is not advanced when a logical slot is lost
Date
Msg-id CAKrAKeW_qQw=Q4o8Sqbgu8oSOoZQN6umkD8p-=saf4JGFeWM=Q@mail.gmail.com
Whole thread Raw
In response to Re: Catalog_xmin is not advanced when a logical slot is lost  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: Catalog_xmin is not advanced when a logical slot is lost
List pgsql-hackers


On Mon, Nov 21, 2022 at 8:05 AM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
On 2022-Nov-21, sirisha chamarthi wrote:

> > > I am a fan of stricter, all-assumption-covering conditions. In case we
> > > don't want to check restart_lsn, an Assert might be useful to validate
> > > our assumption.
> >
> > Agreed.  I'll throw in an assert.
>
> Changed this in the patch to throw an assert.

Thank you.  I had pushed mine for CirrusCI to test, and it failed the
assert I added in slot.c:
https://cirrus-ci.com/build/4786354503548928
Not yet sure why, looking into it.

Can this be because restart_lsn is not set to InvalidXLogRecPtr for the physical slots? My repro is as follows:

select pg_create_physical_replication_slot('s5');
// Load some data to invalidate slot
postgres@pgvm:~$ /usr/local/pgsql/bin/pg_receivewal -S s5 -D .
pg_receivewal: error: unexpected termination of replication stream: ERROR:  requested WAL segment 0000000100000000000000EB has already been removed
pg_receivewal: disconnected; waiting 5 seconds to try again
pg_receivewal: error: unexpected termination of replication stream: ERROR:  requested WAL segment 0000000100000000000000EB has already been removed
pg_receivewal: disconnected; waiting 5 seconds to try again
^Cpostgres@pgvm:~$ /usr/local/pgsql/bin/psql
psql (16devel)
Type "help" for help.

postgres=# select * from pg_replication_slots;
 slot_name |    plugin     | slot_type | datoid | database | temporary | active | active_pid | xmin | catalog_xmin | restart_lsn | confirmed_flush_lsn | wal_status | safe_wal_size | two_phase
-----------+---------------+-----------+--------+----------+-----------+--------+------------+------+--------------+-------------+---------------------+------------+---------------+-----------
 s3        | test_decoding | logical   |      5 | postgres | f         | f      |            |      |          769 |             | 0/A992E7D0          | lost       |               | f
 s5        |               | physical  |        |          | f         | f      |            |      |              | 0/EB000000  |                     | lost       |               | f

 


--
Álvaro Herrera         PostgreSQL Developer  —  https://www.EnterpriseDB.com/

pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Reducing power consumption on idle servers
Next
From: Tom Lane
Date:
Subject: Re: Sending SIGABRT to child processes (was Re: Strange failure on mamba)