On Wed, 12 Feb 2020 at 00:43, Tom Lane <t...@sss.pgh.pa.us> wrote: > > I took a brief look through this patch. I agree with the fundamental > idea that we shouldn't need to use the heavyweight lock manager for > relation extension, since deadlock is not a concern and no backend > should ever need to hold more than one such lock at once. But it feels > to me like this particular solution is rather seriously overengineered. > I would like to suggest that we do something similar to Robert Haas' > excellent hack (daa7527af) for the !HAVE_SPINLOCK case in lmgr/spin.c, > that is, > > * Create some predetermined number N of LWLocks for relation extension.
My original proposal used LWLocks and hash tables for relation extension but there was a discussion that using LWLocks is not good because it's not interruptible[1]. Because of this reason and that we don't need to have two lock level (shared, exclusive) for relation extension lock we ended up with implementing dedicated lock manager for extension lock. I think we will have that problem if we use LWLocks. Regards, [1] https://www.postgresql.org/message-id/CA%2BTgmoZnWYQvmeqeGyY%2B0j-Tfmx8cTzRadfxJQwK9A-nCQ7GkA%40mail.gmail.com -- Masahiko Sawada http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services