Re: Dynamic shared memory areas

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Dilip Kumar <dilipbalaut(at)gmail(dot)com>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Dynamic shared memory areas
Date: 2016-11-10 05:37:17
Message-ID: CAEepm=3TkRkdFRCb+2FCcqj2bXa3ZCjXtyW-Y6Qwdj-xHJ5cwQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Nov 1, 2016 at 5:06 PM, Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> On Wed, Oct 5, 2016 at 11:28 PM, Thomas Munro
> <thomas(dot)munro(at)enterprisedb(dot)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 Content-Type Size
dsa-v5.patch application/octet-stream 133.0 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Haribabu Kommi 2016-11-10 06:10:54 Re: pg_hba_file_settings view patch
Previous Message Andreas Karlsson 2016-11-10 05:27:08 Re: pg_sequence catalog