Re: Connections hang indefinitely while taking a gin index's LWLock buffer_content lock(PG10.7)
x4mmm@yandex-team.ru
From: Andrey Borodin <x4mmm@yandex-team.ru>
To: Peter Geoghegan <pg@bowt.ie>
Cc: Alexander Korotkov <a.korotkov@postgrespro.ru>,
chenhj <chjischj@163.com>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2019-09-30T05:38:10Z
Lists: pgsql-hackers
> 29 сент. 2019 г., в 21:27, Alexander Korotkov <a.korotkov@postgrespro.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?
> 30 сент. 2019 г., в 0:52, Peter Geoghegan <pg@bowt.ie> написал(а):
>
> Why is it okay
> that there is no nbtree-style distinction between page deletion and
> page recycling?
As far as I understand deleted page is stamped with
GinPageSetDeleteXid(page, ReadNewTransactionId());
It will not be recycled until that Xid is far behind.
BTW we found a small bug (wraparound) in similar GiST and B-tree implementations.
Probably, it's there in GIN too.
--
Andrey Borodin
Open source RDBMS development team leader
Yandex.Cloud
Commits
-
Fix traversing to the deleted GIN page via downlink
- ab64b474d9be 10.12 landed
- c0bf35421529 11.7 landed
- ee437ca7408b 12.2 landed
- d5ad7a09afd0 13.0 landed
- 1414821e1688 9.4.26 landed
- 4fc4856849de 9.5.21 landed
- 99f5888d358a 9.6.17 landed
-
Revise GIN README
- b6f57c2d7bfc 10.12 landed
- 287192bda245 11.7 landed
- ca05fa5375eb 12.2 landed
- 32ca32d0bed4 13.0 landed
- 91ce01a6e07b 9.4.26 landed
- 8165384babd9 9.5.21 landed
- 84dcf5235984 9.6.17 landed
-
Fix deadlock between ginDeletePage() and ginStepRight()
- 21ad61ab3178 10.12 landed
- 9f292798992e 11.7 landed
- 051c50c01c32 12.2 landed
- e14641197a56 13.0 landed