pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: Relations being opened without any lock whatever
Date: Mon, 01 Oct 2018 09:29:18 -0400
Message-ID: <21004.1538400558@sss.pgh.pa.us> (raw)
In-Reply-To: <eda81aff-89c2-aed4-2997-548d1b4615e5@lab.ntt.co.jp>
References: <2038.1538335244@sss.pgh.pa.us>
	<eda81aff-89c2-aed4-2997-548d1b4615e5@lab.ntt.co.jp>

Amit Langote <Langote_Amit_f8@lab.ntt.co.jp> writes:
> On 2018/10/01 4:20, Tom Lane wrote:
>> Running the regression tests with the patch I showed in
>> https://www.postgresql.org/message-id/16565.1538327894@sss.pgh.pa.us

> Maybe you've noticed but the relation_open calls coming from bootstrap.c
> all pass NoLock which trigger the WARNING:

Yeah, I'd missed noticing that at the time I posted that patch, but I
sure noticed after changing the WARNING to an Assert ;-)

> Do we need to do something about that, like teaching boot_openrel() and
> gettype() in bootstrap.c to pass AccessShareLock instead of NoLock?

No, bootstrap mode has no need for locking.  I think the right fix is
just to skip the check:
 
+	/*
+	 * If we didn't get the lock ourselves, assert that caller holds one,
+	 * except in bootstrap mode where no locks are used.
+	 */
+	Assert(lockmode != NoLock ||
+		   IsBootstrapProcessingMode() ||
+		   CheckRelationLockedByMe(r, AccessShareLock, true));

It's possible that at some point we'd decide to make bootstrap mode
do locking the same as normal mode, but that's not a change I want
to make as part of this patch.

			regards, tom lane




view thread (5+ messages)

Message-ID: <21004.1538400558@sss.pgh.pa.us>
Permalink:  ../21004.1538400558@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/21004.1538400558@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, Langote_Amit_f8@lab.ntt.co.jp, pgsql-hackers@lists.postgresql.org
  Subject: Re: Relations being opened without any lock whatever
  In-Reply-To: <21004.1538400558@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