pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Masahiko Sawada <masahiko.sawada@2ndquadrant.com>
Cc: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: Re: Race condition in SyncRepGetSyncStandbysPriority
Date: Sat, 18 Apr 2020 12:00:19 -0400
Message-ID: <22664.1587225619@sss.pgh.pa.us> (raw)
In-Reply-To: <CA+fd4k4oJZYmi8+U=_8_CH3Lwk2ZQoeV2rmGkYtvoAnHXsQsTQ@mail.gmail.com>
References: <23215.1587051546@sss.pgh.pa.us>
	<20200417.145834.1847060913969327935.horikyota.ntt@gmail.com>
	<3f58063d-2544-aea8-07aa-7e0c35484187@oss.nttdata.com>
	<20200417.170706.1152908438290368702.horikyota.ntt@gmail.com>
	<3020.1587137510@sss.pgh.pa.us>
	<CA+fd4k4oJZYmi8+U=_8_CH3Lwk2ZQoeV2rmGkYtvoAnHXsQsTQ@mail.gmail.com>

Masahiko Sawada <masahiko.sawada@2ndquadrant.com> writes:
> On Sat, 18 Apr 2020 at 00:31, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> +   /* Quick out if not even configured to be synchronous */
>> +   if (SyncRepConfig == NULL)
>> +       return false;

> I felt strange a bit that we do the above check in
> SyncRepGetSyncRecPtr() because SyncRepReleaseWaiters() which is the
> only caller says the following before calling it:

Notice there was such a test in SyncRepGetSyncRecPtr already --- I just
moved it to be before doing some work instead of after.

> Can we either change it to an assertion, move it to before acquiring
> SyncRepLock in SyncRepReleaseWaiters or just remove it?

I have no objection to that in principle, but it seems like it's a
change in SyncRepGetSyncRecPtr's API that is not necessary to fix
this bug.  So I'd rather leave it to happen along with the larger
API changes (getting rid of am_sync) that are proposed for v14.

			regards, tom lane





view thread (38+ messages)  latest in thread

Message-ID: <22664.1587225619@sss.pgh.pa.us>
Permalink:  ../22664.1587225619@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/22664.1587225619@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, masahiko.sawada@2ndquadrant.com, horikyota.ntt@gmail.com, masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: Race condition in SyncRepGetSyncStandbysPriority
  In-Reply-To: <22664.1587225619@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