Re: Taking into account syncrep position in flush_lsn reported by apply worker

From: Arseny Sher <ars(at)neon(dot)tech>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Taking into account syncrep position in flush_lsn reported by apply worker
Date: 2024-08-14 13:54:52
Message-ID: 71c7b213-5352-4bf4-ab3e-38fd45d7f241@neon.tech
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 8/13/24 06:35, Amit Kapila wrote:
> On Mon, Aug 12, 2024 at 3:43 PM Arseny Sher <ars(at)neon(dot)tech> wrote:
>>
>> Sorry for the poor formatting of the message above, this should be better:
>>
>> Hey. Currently synchronous_commit is disabled for logical apply worker
>> on the ground that reported flush_lsn includes only locally flushed data
>> so slot (publisher) preserves everything higher than this, and so in
>> case of subscriber restart no data is lost. However, imagine that
>> subscriber is made highly available by standby to which synchronous
>> replication is enabled. Then reported flush_lsn is ignorant of this
>> synchronous replication progress, and in case of failover data loss may
>> occur if subscriber managed to ack flush_lsn ahead of syncrep.
>>
>
> Won't the same can be achieved by enabling the synchronous_commit
> parameter for a subscription?

Nope, because it would force WAL flush and wait for replication to the
standby in the apply worker, slowing down it. The logic missing
currently is not to wait for the synchronous commit, but still mind its
progress in the flush_lsn reporting.

-- cheers, arseny

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Sergey Solovev 2024-08-14 14:02:05 [BUG FIX]: invalid meson version detection
Previous Message Amul Sul 2024-08-14 13:19:57 Re: pg_verifybackup: TAR format backup verification