pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki.linnakangas@iki.fi>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Fix bug in bulk extending temp relation after failure
Date: Fri, 02 Feb 2024 19:32:33 +0000
Message-ID: <E1rVzH7-004OC5-8N@gemulon.postgresql.org> (raw)

Fix bug in bulk extending temp relation after failure

A ResourceOwnerEnlarge() call was missing. That led to an error:

ERROR:  ResourceOwnerRemember called but array was full

and an assertion failure, if you tried to extend a temp relation again
after a failure. Alexander's test case used running out of disk space
to trigger the original failure.

This bug was introduced in the large ResourceOwner rewrite commit
b8bff07daa. Before that, the UnpinLocalBuffer() call guaranteed that
the subsequent PinLocalBuffer() will succeed, but after the rewrite,
releasing an old resource doesn't guarantee that there is space for a
new one.

Add a comment explaining why the UnpinBuffer + PinBuffer calls in
BufferAlloc(), with no ResourceOwnerEnlarge() in between, are safe.

Reported-by: Alexander Lakhin
Discussion: https://www.postgresql.org/message-id/dc574fea-c83e-a600-08cd-10881762e4fa@gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d212957254de85aad934e2601e5a07661db268fb

Modified Files
--------------
src/backend/storage/buffer/localbuf.c | 5 +++++
src/backend/utils/resowner/resowner.c | 7 ++++++-
2 files changed, 11 insertions(+), 1 deletion(-)



view thread (2+ messages)

Message-ID: <E1rVzH7-004OC5-8N@gemulon.postgresql.org>
Permalink:  ../E1rVzH7-004OC5-8N@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1rVzH7-004OC5-8N@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-committers@postgresql.org
  Cc: heikki.linnakangas@iki.fi, pgsql-committers@lists.postgresql.org
  Subject: Re: pgsql: Fix bug in bulk extending temp relation after failure
  In-Reply-To: <E1rVzH7-004OC5-8N@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox