RE: Starting logical replication at arbitrary point that's available in WAL - Mailing list pgsql-general

From Zhijie Hou (Fujitsu)
Subject RE: Starting logical replication at arbitrary point that's available in WAL
Date
Msg-id OS0PR01MB5716587A22BEBE121E988AC6940E2@OS0PR01MB5716.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Starting logical replication at arbitrary point that's available in WAL  (Alexander Uvizhev <uvizhe@posteo.net>)
Responses Re: Starting logical replication at arbitrary point that's available in WAL
List pgsql-general
On Friday, December 27, 2024 7:39 PM Alexander Uvizhev <uvizhe@posteo.net> wrote:

Hi,

> I'm doing a logical replication using streaming replication protocol and
> I'm trying to start a stream from a certain arbitrary point that's
> available in WAL. However, both CREATE_REPLICATION_SLOT and
> pg_create_logical_replication_slot() create slot with nearly last LSN/XID.
> 
> Is it possible to create a replication slot with arbitrary LSN/XID values?

I think it's not supported to specify arbitrary LSN/XID values for a newly
created slot in core. However, if you have an existing slot with an older LSN/XID, you
can copy it using pg_copy_logical_replication_slot, and then advance the copied
slot to your desired position with pg_replication_slot_advance.

> 
> Also pg_create_logical_replication_slot() for some reason gives
> different result than CREATE_REPLICATION_SLOT: new slot's `catalog_xmin`
> is set to the smallest `catalog_xmin` among already existing slots.
> Looks like a bug.

Could you provide a script to reproduce this issue ?
That would be helpful in diagnosing the reason.

Best Regards,
Hou zj

pgsql-general by date:

Previous
From: Alexander Uvizhev
Date:
Subject: Starting logical replication at arbitrary point that's available in WAL
Next
From: Alexander Uvizhev
Date:
Subject: Re: Starting logical replication at arbitrary point that's available in WAL