Re: Fast DSM segments

From: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Fast DSM segments
Date: 2020-07-31 05:55:12
Message-ID: CA+hUKGJpK6QXg1YCYJD7Dg0rbbphHBc4zL5f2Fu6y6UgSX2SCg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, Jul 27, 2020 at 2:45 PM Thomas Munro <thomas(dot)munro(at)gmail(dot)com> wrote:
> Here's a new version, using the name min_dynamic_shared_memory, which
> sounds better to me. Any objections? I also fixed the GUC's maximum
> setting so that it's sure to fit in size_t.

I pushed it like that. Happy to rename the GUC if someone has a better idea.

I don't really love the way dsm_create()'s code flows, but I didn't
see another way to do this within the existing constraints. I think
it'd be nice to rewrite this thing to get rid of the random
number-based handles that are directly convertible to key_t/pathname,
and instead use something holding {slot number, generation number}.
Then you could improve that code flow and get rid of several cases of
linear array scans under an exclusive lock. The underlying
key_t/pathname would live in the slot. You'd need a new way to find
the control segment itself after a restart, where
dsm_cleanup_using_control_segment() cleans up after the previous
incarnation, but I think that just requires putting the key_t/pathname
directly in PGShmemHeader, instead of a new {slot number, generation
number} style handle. Or maybe a separate mapped file opened by well
known pathname, or something like that.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Kasahara Tatsuhito 2020-07-31 06:26:44 Re: autovac issue with large number of tables
Previous Message Michael Paquier 2020-07-31 05:34:59 Re: Fix minor source code comment mistake