Re: Connections hang indefinitely while taking a gin index's LWLock buffer_content lock(PG10.7)

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Andrey Borodin <x4mmm(at)yandex-team(dot)ru>
Cc: Peter Geoghegan <pg(at)bowt(dot)ie>, chenhj <chjischj(at)163(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Connections hang indefinitely while taking a gin index's LWLock buffer_content lock(PG10.7)
Date: 2019-09-30 17:37:54
Message-ID: CAPpHfdsCLdv-FfAk+h_8rjVpJ0AkW1schAcs10kXqtMO_8W_VA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Sep 30, 2019 at 8:38 AM Andrey Borodin <x4mmm(at)yandex-team(dot)ru> wrote:
>
> > 29 сент. 2019 г., в 21:27, Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru> написал(а):
> >
> > Patch with fix is attached. Idea is simple: ginScanToDelete() now
> > keeps exclusive lock on left page eliminating the need to relock it.
> > So, we preserve left-to-right locking order and can't deadlock with
> > ginStepRight().
>
> In this function ginDeletePage(gvs, blkno, BufferGetBlockNumber(me->leftBuffer),...)
> we are going to reread buffer
> lBuffer = ReadBufferExtended(gvs->index, MAIN_FORKNUM, leftBlkno,
> RBM_NORMAL, gvs->strategy);
> Is it OK?

That's related not only to left buffer. We also could pass buffer
instead of deleteBlkno. And with some code changes it's also possible
to pass buffer instead of parentBlkno. But I decided to keep code
changes minimal at least for backpatch version. We could apply such
optimization to master as a separate patch.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Fabrízio de Royes Mello 2019-09-30 17:46:42 Re: Hooks for session start and end, take two
Previous Message Tomas Vondra 2019-09-30 17:29:51 Re: Optimize partial TOAST decompression