Re: Error while creating subscription when server is running in single user mode

From: Andres Freund <andres(at)anarazel(dot)de>
To: Robert Haas <robertmhaas(at)gmail(dot)com>, Petr Jelinek <petr(at)2ndquadrant(dot)com>
Cc: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Dilip Kumar <dilipbalaut(at)gmail(dot)com>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, tushar <tushar(dot)ahuja(at)enterprisedb(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Error while creating subscription when server is running in single user mode
Date: 2017-06-06 23:20:57
Message-ID: 20170606232057.rjovmlgkm7qf6is7@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2017-06-06 12:53:21 -0700, Andres Freund wrote:
> On 2017-06-06 15:48:42 -0400, Robert Haas wrote:
> > On Fri, Jun 2, 2017 at 3:24 PM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> > > Latches work in single user mode, it's just that the new code for some
> > > reason uses uninitialized memory as the latch. As I pointed out above,
> > > the new code really should just use MyLatch instead of
> > > MyProc->procLatch.
>
> FWIW, I'd misremembered some code here, and we actually reach the
> function initializing the shared latch, even in single user mode.
>
>
> > We seem to have accumulated quite a few instance of that.
> >
> > [rhaas pgsql]$ git grep MyLatch | wc -l
> > 116
> > [rhaas pgsql]$ git grep 'MyProc->procLatch' | wc -l
> > 33
> >
> > Most of the offenders are in src/backend/replication, but there are
> > some that are related to parallelism as well (bgworker.c, pqmq.c,
> > parallel.c, condition_variable.c). Maybe we (you?) should just go and
> > change them all. I don't think using MyLatch instead of
> > MyProc->procLatch has become automatic for everyone yet.
>
> Nevertheless this should be changed. Will do.

Here's the patch for that, also addressing some issues I found while
updating those callsites (separate thread started, too).

- Andres

Attachment Content-Type Size
0001-Clean-up-latch-related-code.patch text/x-patch 11.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2017-06-06 23:40:27 Re: GSoC 2017 weekly progress reports ("Explicitly support predicate locks in index access methods besides b-tree")
Previous Message Jim Van Fleet 2017-06-06 23:06:12 Re: HACKERS[PROPOSAL] split ProcArrayLock into multiple parts