Re: 001_rep_changes.pl stalls

Kyotaro Horiguchi <horikyota.ntt@gmail.com>

From: Kyotaro Horiguchi <horikyota.ntt@gmail.com>
To: masao.fujii@oss.nttdata.com
Cc: noah@leadboat.com, tgl@sss.pgh.pa.us, pgsql-hackers@postgresql.org
Date: 2020-04-20T07:24:06Z
Lists: pgsql-hackers
At Mon, 20 Apr 2020 14:30:08 +0900, Fujii Masao <masao.fujii@oss.nttdata.com> wrote in 
> 
> 
> On 2020/04/18 16:01, Noah Misch wrote:
> > On Sat, Apr 18, 2020 at 12:29:58AM +0900, Fujii Masao wrote:
> >>> 4. Keep the WalSndLoop() wait, but condition it on !logical.  This is
> >>> the
> >>>     minimal fix, but it crudely punches through the abstraction between
> >>>     WalSndLoop() and its WalSndSendDataCallback.
> >>
> >> (4) also looks good because it's simple, if we can redesign those
> >> functions in good shape.
> > Let's do that.  I'm attaching the replacement implementation and the
> > revert of
> > v1.
> 
> Thanks for the patch! Though referencing XLogSendLogical inside
> WalSndLoop()
> might be a bit ugly,, I'm fine with this change because it's simple
> and easier
> to understand.

I thought that if we do this, read_data returns boolean that indiates
whether wait for latch or incoming packet, or returns a wake event
mask.


regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



Commits

  1. In caught-up logical walsender, sleep only in WalSndWaitForWal().

  2. Revert "When WalSndCaughtUp, sleep only in WalSndWaitForWal()."

  3. Add a wait_for_catchup() before immediate stop of a test master.

  4. When WalSndCaughtUp, sleep only in WalSndWaitForWal().