Re: could sent_lsn be lower than write/flush/replay_lsn?

Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>

From: Ashutosh Bapat <ashutosh.bapat.oss@gmail.com>
To: cca5507 <2624345507@qq.com>, Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2025-12-29T07:13:31Z
Lists: pgsql-hackers
Hi Jaime,

On Sat, Dec 27, 2025 at 1:18 PM cca5507 <2624345507@qq.com> wrote:
>
> Hi Jaime,
>
> The $subject can happen during logical replication start, it's just fine.
>
> > 2025-12-26 12:17:41.861 -05 [pid=2667517;l=1;tx=0] LOG:  38B7/CEBC9330
> > has been already streamed, forwarding to 38B7/D2C9C038
>
> The logical replica requests starting at 38B7/CEBC9330, but the slot's confirmed_flush_lsn
> is at 38B7/D2C9C038, so forwarding to it.
>
> > 2025-12-26 12:17:41.867 -05 [pid=2667517;l=4;tx=0] DETAIL:  Streaming
> > transactions committing after 38B7/D2C9C038, reading WAL from
> > 38B0/2261B890.
>
> The publisher must read WAL from the slot's restart_lsn (38B0/2261B890), but only
> transactions committed after 38B7/D2C9C038 will be sent to the logical replica.
>
> The sent_lsn is just where the wal sender currently reading, so it could be lower than
> write/flush/replay_lsn.

+1.

I guess, the logical replication is restarting in a loop. If that's
the case, you will find multiple errors happening in the loop. Another
guess is it's because of the walsender/receiver timeout. Do you see
timeout error from the corresponding background workers? What's
downstream?


-- 
Best Wishes,
Ashutosh Bapat