Re: could sent_lsn be lower than write/flush/replay_lsn? - Mailing list pgsql-hackers

From cca5507
Subject Re: could sent_lsn be lower than write/flush/replay_lsn?
Date
Msg-id tencent_4A291FF4D8E985EA1622D742A410C814E00A@qq.com
Whole thread Raw
In response to could sent_lsn be lower than write/flush/replay_lsn?  (Jaime Casanova <jcasanov@systemguards.com.ec>)
List pgsql-hackers
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.

Hope this can answer your question.

--
Regards,
ChangAo Chen

pgsql-hackers by date:

Previous
From: "zengman"
Date:
Subject: Re:Question about partial index WHERE clause predicate ordering
Next
From: Pavel Stehule
Date:
Subject: Re: proposal: schema variables