From: | Aleksander Alekseev <aleksander(at)tigerdata(dot)com> |
---|---|
To: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Cc: | Rahila Syed <rahilasyed90(at)gmail(dot)com>, Melih Mutlu <m(dot)melihmutlu(at)gmail(dot)com> |
Subject: | Re: Sending unflushed WAL in physical replication |
Date: | 2025-09-30 15:25:14 |
Message-ID: | CAJ7c6TNrG5ReyT5HgRGvoFjbF7BHBjb281oW58=OYPj=u4izqQ@mail.gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
> This is a great question. I'm currently working on implementing a solution for this.
> One possible solution is to write the records to a spill file when the flush pointer
> indicates that none have been flushed on the primary. Once they have been flushed
> on the primary, the records can then be copied from the spill file to the WAL segments.
> While this method may lead to increased I/O, if such spills are infrequent, the overall
> performance impact should be minimal.
>
> Another option would be to notify the sender that there is no more space available
> and to pause sending additional data until records are flushed on the sender side.
> However, this approach could reintroduce some of the replication lag or network
> latency that we are aiming to minimize.
>
> Kindly let me know your views.
Both options don't strike me as great design choices.
A proper solution IMO would be to send and record flushPtr as a usual
WAL record (a new resource manager, perhaps). When a replica is
promoted to master or restarted it should truncate WAL according to
the latest recorded flushPtr. The only thing we will have to worry
about is to make sure the latest recorded flushPtr is never truncated,
including regular recycling of WAL segments. Everything else will work
as it is now, including cascaded replication for instance.
--
Best regards,
Aleksander Alekseev
From | Date | Subject | |
---|---|---|---|
Next Message | Aleksander Alekseev | 2025-09-30 15:55:16 | Re: The ability of postgres to determine loss of files of the main fork |
Previous Message | Nazir Bilal Yavuz | 2025-09-30 15:23:25 | Re: Update Windows CI Task Names: Server 2022 + VS 2022 Upgrade |