Re: Relations being opened without any lock whatever

From: Amit Langote <Langote_Amit_f8(at)lab(dot)ntt(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Relations being opened without any lock whatever
Date: 2018-10-01 07:19:58
Message-ID: eda81aff-89c2-aed4-2997-548d1b4615e5@lab.ntt.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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
> exposes two places where HEAD is opening relations without having
> any lock at all on them:

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

$ initdb -D /tmp/foo
<snip>
WARNING: relation_open: no lock held on pg_type
WARNING: relation_open: no lock held on pg_attrdef
WARNING: relation_open: no lock held on pg_constraint
WARNING: relation_open: no lock held on pg_inherits
WARNING: relation_open: no lock held on pg_index
WARNING: relation_open: no lock held on pg_operator
WARNING: relation_open: no lock held on pg_opfamily
<so on>

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

Thanks,
Amit

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Langote 2018-10-01 07:27:57 Re: partition tree inspection functions
Previous Message Michael Paquier 2018-10-01 07:17:57 Re: [HACKERS] SERIALIZABLE with parallel query