public inbox for [email protected]  
help / color / mirror / Atom feed
Logical decoding
3+ messages / 3 participants
[nested] [flat]

* Logical decoding
@ 2025-02-20 05:04  Jethish Jethish <[email protected]>
  0 siblings, 2 replies; 3+ messages in thread

From: Jethish Jethish @ 2025-02-20 05:04 UTC (permalink / raw)
  To: [email protected]

Hi everyone,

Is there is any option to perform logical decoding on an active replication
slot.
I'm trying to decode a replication slot but it throughs an error as below.

ERROR: replication slot "my_sub" is active for PID 2525720


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Logical decoding
@ 2025-02-20 09:27  Tomas Vondra <[email protected]>
  parent: Jethish Jethish <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Tomas Vondra @ 2025-02-20 09:27 UTC (permalink / raw)
  To: Jethish Jethish <[email protected]>; [email protected]

On 2/20/25 06:04, Jethish Jethish wrote:
> Hi everyone,
> 
> Is there is any option to perform logical decoding on an active
> replication slot.
> I'm trying to decode a replication slot but it throughs an error as below.
> 
> ERROR: replication slot "my_sub" is active for PID 2525720

No, not really. The whole point of this error is to prevent exactly
this, pretty much - to only allow a single process doing logical
decoding on a slot.

What are you trying to solve / achieve? Why do you need (or think you
need) logical decoding on an active slot?


regards

-- 
Tomas Vondra







^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Logical decoding
@ 2025-02-21 21:45  Justin <[email protected]>
  parent: Jethish Jethish <[email protected]>
  1 sibling, 0 replies; 3+ messages in thread

From: Justin @ 2025-02-21 21:45 UTC (permalink / raw)
  To: Jethish Jethish <[email protected]>; +Cc: [email protected]

On Thu, Feb 20, 2025 at 12:04 AM Jethish Jethish <[email protected]>
wrote:

> Hi everyone,
>
> Is there is any option to perform logical decoding on an active
> replication slot.
> I'm trying to decode a replication slot but it throughs an error as below.
>
> ERROR: replication slot "my_sub" is active for PID 2525720
>


Hi Jethish,

You can by copying the LR slot

SELECT  pg_copy_logical_replication_slot ( '<slot_name>', --source slot
'peek', --destination slot name
true,  --lets make a temporary slot, so we don't have clean up after
ourselves
'test_decoding' --plugin name can be any LR plugin this one let's us see
what is going on
)

Then peek at what the slot is doing

SELECT * FROM pg_logical_slot_peek_changes('peek' , --name of the slot
NULL, --lsn number to start from  can jump ahead,
1 ); --how many transaction to get back from the query this will return
multiple rows for each row affect by the transaction.

select pg_drop_replication_slot(<slot_name>)  --how we drop the slot


^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2025-02-21 21:45 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2025-02-20 05:04 Logical decoding Jethish Jethish <[email protected]>
2025-02-20 09:27 ` Tomas Vondra <[email protected]>
2025-02-21 21:45 ` Justin <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox