Re: Dynamic shared memory areas - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Dynamic shared memory areas
Date
Msg-id CAEepm=3TkRkdFRCb+2FCcqj2bXa3ZCjXtyW-Y6Qwdj-xHJ5cwQ@mail.gmail.com
Whole thread Raw
In response to Re: Dynamic shared memory areas  (Thomas Munro <thomas.munro@enterprisedb.com>)
Responses Re: Dynamic shared memory areas
Re: Dynamic shared memory areas
List pgsql-hackers
On Tue, Nov 1, 2016 at 5:06 PM, Thomas Munro
<thomas.munro@enterprisedb.com> wrote:
> On Wed, Oct 5, 2016 at 11:28 PM, Thomas Munro
> <thomas.munro@enterprisedb.com> wrote:
>> [dsa-v3.patch]
>
> Here is a new version which just adds CLOBBER_FREED_MEMORY support to dsa_free.

Here is a new version that fixes a bug I discovered in freepage.c today.

Details:  When dsa_free decides to give back a whole superblock back
to the free page manager for a segment with FreePageManagerPut, and
there was already exactly one span of exactly one free page in that
segment, and the span being 'put' is not adjacent to that existing
free page, then the singleton format must be converted to a btree with
the existing page as root and the newly put span as the sole leaf.
But in that special case we forgot to add the newly put span to the
appropriate free list.  Not only did we lose track of it, but a future
call to FreePageManagerPut might try to merge it with another adjacent
span, which will try to manipulate the freelist that it expects it to
be in and blow up.  The fix is just to add a call to
FreePagePushSpanLeader in this corner case before the early return.

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

Attachment

pgsql-hackers by date:

Previous
From: Andreas Karlsson
Date:
Subject: Re: pg_sequence catalog
Next
From: Haribabu Kommi
Date:
Subject: Re: pg_hba_file_settings view patch