Re: Dynamic shared memory areas

Thomas Munro <thomas.munro@enterprisedb.com>

From: Thomas Munro <thomas.munro@enterprisedb.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Dilip Kumar <dilipbalaut@gmail.com>, Pg Hackers <pgsql-hackers@postgresql.org>
Date: 2016-11-25T12:48:56Z
Lists: pgsql-hackers

Attachments

On Thu, Nov 24, 2016 at 1:07 AM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> The attached patch is just for discussion only...  I need to resolve
> that contiguous_pages question and do some more testing.

As Dilip discovered, there was a problem with resource cleanup for DSA
areas created inside pre-existing DSM segments, which I've now sorted
out in the attached version.  I also updated the copyright messages,
introduced a couple of the new 'unlikely' macros in the address
decoding path, and introduced high_segment_index to avoid scanning
bigger segment arrays than is necessary sometimes.

As for contiguous_pages_dirty, I see what was missing from earlier
attempts at more subtle invalidation: we had failed to set the flag in
cases where FreePageManagerGetInternal was called during a
FreePageManagerPut operation.  What do you think about the logic in
this patch... do you see any ways for contiguous_pages to get out of
date?  There is a new assertion that contiguous_pages matches the
state of the freelists at the end of FreePageManagerGet and
FreePageManagerPut, enabled if you defined FPM_EXTRA_ASSERTS, and this
passes my random allocation pattern testing.

-- 
Thomas Munro
http://www.enterprisedb.com

Commits

  1. Fix off-by-one Asserts in FreePageBtreeInsertInternal/Leaf.

  2. Reserve zero as an invalid DSM handle.