Re: dsa_allocate() faliure

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
Cc: Jakub Glapa <jakub(dot)glapa(at)gmail(dot)com>, Justin Pryzby <pryzby(at)telsasoft(dot)com>, Fabio Isabettini <fisabettini(at)voipfuture(dot)com>, Arne Roland <A(dot)Roland(at)index(dot)de>, Sand Stone <sand(dot)m(dot)stone(at)gmail(dot)com>, Rick Otten <rottenwindfish(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: dsa_allocate() faliure
Date: 2019-02-10 06:40:52
Message-ID: CA+TgmoY4t7r9ac2vRnX1grL7yAaN9hJK6kG_8-D6ro8hNNjz-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

On Sun, Feb 10, 2019 at 2:37 AM Thomas Munro
<thomas(dot)munro(at)enterprisedb(dot)com> wrote:
> ... but why would it do that? I can reproduce cases where (for
> example) FreePageManagerPutInternal() returns 179, and then
> FreePageManagerLargestContiguous() returns 179, but then after
> FreePageBtreeCleanup() it returns 178. At that point FreePageDump()
> says:
>
> btree depth 1:
> 77(at)0 l: 27(1) 78(178)
> freelists:
> 1: 27
> 129: 78(178)
>
> But at first glance it shouldn't be allocating pages, because it just
> does consolidation to try to convert to singleton format, and then it
> does recycle list cleanup using soft=true so that no allocation of
> btree pages should occur.

I think I see what's happening. At the moment the problem occurs,
there is no btree - there is only a singleton range. So
FreePageManagerInternal() takes the fpm->btree_depth == 0 branch and
then ends up in the section with the comment /* Not contiguous; we
need to initialize the btree. */. And that section, sadly, does not
respect the 'soft' flag, so kaboom. Something like the attached might
fix it.

Boy, I love FreePageManagerDump!

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

Attachment Content-Type Size
dsa-allocate-btree-init-soft.patch application/octet-stream 598 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrey Borodin 2019-02-10 08:25:19 Re: [WIP] CREATE SUBSCRIPTION with FOR TABLES clause (table filter)
Previous Message Robert Haas 2019-02-10 06:26:14 Re: dsa_allocate() faliure

Browse pgsql-performance by date

  From Date Subject
Next Message Justin Pryzby 2019-02-10 16:00:35 Re: dsa_allocate() faliure
Previous Message Robert Haas 2019-02-10 06:26:14 Re: dsa_allocate() faliure