Re: pgsql: dshash: Add sequential scan support.

From: Andres Freund <andres(at)anarazel(dot)de>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pgsql: dshash: Add sequential scan support.
Date: 2022-07-04 23:25:38
Message-ID: 20220704232538.x75aaawzjczhpvc6@awork3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi,

On 2022-07-05 11:20:54 +1200, Thomas Munro wrote:
> On Tue, Jul 5, 2022 at 8:54 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
> > > Yeah, it's all for assertions... let's just remove it. Those
> > > assertions were useful to me at some stage in development but won't
> > > hold as well as I thought, at least without widespread PG_FINALLY(),
> > > which wouldn't be nice.
> >
> > Hm. I'd be inclined to at least add a few more
> > Assert(!LWLockHeldByMe[InMode]()) style assertions. E.g. to
> > dshash_find_or_insert().
>
> Yeah, I was wondering about that, but it needs to check the whole 128
> element lock array.

I think it'd be ok to just check the current partition - yes, it'd not catch
cases where we're still holding a lock on another partition, but that's imo
not too bad?

> Hmm, yeah that seems OK for assertion builds.
> Since there were 6 places with I-hold-no-lock assertions, I shoved the
> loop into a function so I could do:
>
> - Assert(!status->hash_table->find_locked);
> + assert_no_lock_held_by_me(hash_table);

I am a *bit* wary about the costs of that, even in assert builds - each of the
partition checks in the loop will in turn need to iterate through
held_lwlocks. But I guess we can also just later weaken them if it turns out
to be a problem.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-07-05 00:49:07 Re: pgsql: Change timeline field of IDENTIFY_SYSTEM to int8
Previous Message Thomas Munro 2022-07-04 23:20:54 Re: pgsql: dshash: Add sequential scan support.

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Smith 2022-07-05 00:44:32 Re: Handle infinite recursion in logical replication setup
Previous Message Thomas Munro 2022-07-04 23:20:54 Re: pgsql: dshash: Add sequential scan support.