Re: server log inflates due to pg_logical_slot_peek_changes/pg_logical_slot_get_changes calls - Mailing list pgsql-hackers

From Jeevan Ladhe
Subject Re: server log inflates due to pg_logical_slot_peek_changes/pg_logical_slot_get_changes calls
Date
Msg-id CANm22Cg6daAozpAOMguGkoG5mhzzwf9CFoPXgek6e8tod2LSww@mail.gmail.com
Whole thread Raw
In response to Re: server log inflates due to pg_logical_slot_peek_changes/pg_logical_slot_get_changes calls  (Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>)
List pgsql-hackers
Thanks, Ashutosh for the reply.

I think those messages are useful when debugging logical replication
problems (imagine missing transaction or inconsistent data between
publisher and subscriber). I don't think pg_logical_slot_get_changes()
or pg_logical_slot_peek_changes() are expected to be called frequently
in a loop.

Yeah right. But can you please shed some light on when these functions
should be called, or are they used only for testing purposes?

Instead you should open a replication connection to
continue to receive logical changes ... forever.

Yes, this is what I have decided to resort to now.

Why do you need to call pg_logical_slot_peek_changes() and
pg_logical_slot_get_changes() frequently?

I was just playing around to do something for logical replication and thought
of doing this quick test where every time interval I read using
pg_logical_slot_peek_changes(), make sure to consume them to a consistent
state, and only then use pg_logical_slot_get_changes() to advance the slot.

Regards,
Jeevan Ladhe

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: logical decoding and replication of sequences, take 2
Next
From: Tomas Vondra
Date:
Subject: Re: logical decoding and replication of sequences, take 2