Re: pgsql: dshash: Add sequential scan support.

From: Andres Freund <andres(at)anarazel(dot)de>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: pgsql-committers(at)lists(dot)postgresql(dot)org, Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
Subject: Re: pgsql: dshash: Add sequential scan support.
Date: 2022-03-11 01:27:12
Message-ID: 20220311012712.botrpsikaufzteyt@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

Hi,

On 2022-03-10 20:09:56 -0500, Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > dshash: Add sequential scan support.
> > Add ability to scan all entries sequentially to dshash. The interface is
> > similar but a bit different both from that of dynahash and simple dshash
> > search functions. The most significant differences is that dshash's interfac
> > always needs a call to dshash_seq_term when scan ends.
>
> Umm ... what about error recovery? Or have you just cemented the
> proposition that long-lived dshashes are unsafe?

I don't think this commit made it worse. dshash_seq_term() releases an lwlock
(which will be released in case of an error) and unsets
hash_table->find_[exclusively_]locked. The latter weren't introduced by this
patch, and are also set by dshash_find().

I agree that ->find_[exclusively_]locked are problematic from an error
recovery perspective.

It's per-backend state at least and just used for assertions. We could remove
it. Or stop checking it in places where it could be set wrongly: dshash_find()
and dshash_detach() couldn't check anymore, but the rest of the assertions
would still be valid afaics?

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Michael Paquier 2022-03-11 02:00:48 pgsql: Fix header inclusion order in xloginsert.c with lz4.h
Previous Message Tom Lane 2022-03-11 01:09:56 Re: pgsql: dshash: Add sequential scan support.

Browse pgsql-hackers by date

  From Date Subject
Next Message Tomas Vondra 2022-03-11 01:56:41 Re: Column Filtering in Logical Replication
Previous Message Tom Lane 2022-03-11 01:09:56 Re: pgsql: dshash: Add sequential scan support.