Re: Speed up transaction completion faster after many relations are accessed in a transaction
David Rowley <dgrowleyml@gmail.com>
From: David Rowley <dgrowleyml@gmail.com>
To: Yura Sokolov <y.sokolov@postgrespro.ru>
Cc: Zhihong Yu <zyu@yugabyte.com>, Michael Paquier <michael@paquier.xyz>, "pgsql-hackers@lists.postgresql.org" <pgsql-hackers@lists.postgresql.org>,
Tom Lane <tgl@sss.pgh.pa.us>, Peter Eisentraut <peter.eisentraut@2ndquadrant.com>, Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>, "Imai, Yoshikazu" <imai.yoshikazu@jp.fujitsu.com>,
Andres Freund <andres@anarazel.de>, Simon Riggs <simon@2ndquadrant.com>
Date: 2022-04-07T04:05:19Z
Lists: pgsql-hackers
On Wed, 6 Apr 2022 at 03:40, Yura Sokolov <y.sokolov@postgrespro.ru> wrote: > I'm looking on patch and don't get some moments. > > `GrantLockLocal` allocates `LOCALLOCKOWNER` and links it into > `locallock->locallockowners`. It links it regardless `owner` could be > NULL. But then `RemoveLocalLock` does `Assert(locallockowner->owner != NULL);`. > Why it should not fail? > > `GrantLockLocal` allocates `LOCALLOCKOWNER` in `TopMemoryContext`. > But there is single `pfree(locallockowner)` in `LockReassignOwner`. > Looks like there should be more `pfree`. Shouldn't they? > > `GrantLockLocal` does `dlist_push_tail`, but isn't it better to > do `dlist_push_head`? Resource owners usually form stack, so usually > when owner searches for itself it is last added to list. > Then `dlist_foreach` will find it sooner if it were added to the head. Thanks for having a look at this. It's a bit unrealistic for me to get a look at addressing these for v15. I've pushed this one out to the next CF. David
Commits
-
Reorder LOCALLOCK structure members to compact the size
- 28988a84cf19 12.0 landed
-
Be more careful to not lose sync in the FE/BE protocol.
- 2b3a8b20c2da 9.5.0 cited