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: 0001-Report-no-unpinned-buffers-as-insufficient-resources.patch
Description: 0001-Report-no-unpinned-buffers-as-insufficient-resources.patch

Reply via email to