[PATCH] Report no unpinned buffers as insufficient resources

From: Ma Xueting <ma(at)sraoss(dot)co(dot)jp>
To: "pgsql-hackers(at)lists(dot)postgresql(dot)org" <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: [PATCH] Report no unpinned buffers as insufficient resources
Date: 2026-09-24 05:25:58
Message-ID: TYWP286MB2571C92032EE9D1B8F2BFACFEF812@TYWP286MB2571.JPNP286.PROD.OUTLOOK.COM
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

StrategyGetBuffer() currently reports "no unpinned buffers available"
using elog(ERROR). As a result, clients receive SQLSTATE XX000
(internal_error), and the message is not translatable.

Although this condition is uncommon, it can occur in user environments,
for example when shared_buffers is configured unusually low. GitLab
encountered this error with a shared_buffers setting of 1 MB:

https://gitlab.com/gitlab-org/omnibus-gitlab/-/work_items/8682

The analogous local-buffer error, "no empty local buffer available",
is already reported using ERRCODE_INSUFFICIENT_RESOURCES.

This patch changes the shared-buffer error to use ereport() with
ERRCODE_INSUFFICIENT_RESOURCES.

I also considered adding a hint suggesting an increase to
shared_buffers. However, a small shared_buffers setting is not the
only possible cause of this error, so I left the hint out of this
version. I'd welcome thoughts on whether such a hint would be useful.

Best regards,
Xueting Ma

Attachment Content-Type Size
0001-Report-no-unpinned-buffers-as-insufficient-resources.patch application/octet-stream 1.0 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2026-09-24 05:27:26 Re: Add a permission check to pg_stat_get_backend_subxact()
Previous Message shveta malik 2026-09-24 05:25:03 Re: Persist slot invalidations before publishing them