pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: masahiko.sawada@2ndquadrant.com
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Race condition in SyncRepGetSyncStandbysPriority
Date: Thu, 16 Apr 2020 14:00:23 -0400
Message-ID: <30110.1587060023@sss.pgh.pa.us> (raw)
In-Reply-To: <43ecec68-abff-6cdb-8412-204451d650ac@oss.nttdata.com>
References: <20200413.153101.688623432137444694.horikyota.ntt@gmail.com>
	<8325.1586828060@sss.pgh.pa.us>
	<CA+fd4k4f+QrGOpEMR3GA6yHakCr6ssJB_EbRrdC-=miwEZf3mQ@mail.gmail.com>
	<20200414.183538.344904915964423903.horikyota.ntt@gmail.com>
	<15616.1586872362@sss.pgh.pa.us>
	<43ecec68-abff-6cdb-8412-204451d650ac@oss.nttdata.com>

Fujii Masao <masao.fujii@oss.nttdata.com> writes:
> On 2020/04/14 22:52, Tom Lane wrote:
>> *Yes it does*.  The existing code can deliver entirely broken results
>> if some walsender exits between where we examine the priorities and
>> where we fetch the WAL pointers.

> IMO that the broken results can be delivered when walsender marked
> as sync exits *and* new walsender comes at that moment. If this new
> walsender uses the WalSnd slot that the exited walsender used,
> SyncRepGetOldestSyncRecPtr() wronly calculates the oldest lsn based
> on this new walsender (i.e., different walsender from one marked as sync).

Right, exactly, sorry that I was not more specific.

> BTW, since the patch changes the API of SyncRepGetSyncStandbys(),
> it should not be back-patched to avoid ABI break. Right?

Anything that is using that is just as broken as the core code is, for the
same reasons, so I don't have a problem with changing its API.  Maybe we
should rename it while we're at it, just to make it clear that we are
breaking any external callers.  (If there are any, which seems somewhat
unlikely.)

The only concession to ABI that I had in mind was to not re-order
the fields of WalSnd in the back branches.

			regards, tom lane





view thread (38+ messages)  latest in thread

Message-ID: <30110.1587060023@sss.pgh.pa.us>
Permalink:  ../30110.1587060023@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/30110.1587060023@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, masao.fujii@oss.nttdata.com, horikyota.ntt@gmail.com, masahiko.sawada@2ndquadrant.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Race condition in SyncRepGetSyncStandbysPriority
  In-Reply-To: <30110.1587060023@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox