[PATCH] Report no unpinned buffers as insufficient resources - Mailing list pgsql-hackers

From Ma Xueting
Subject [PATCH] Report no unpinned buffers as insufficient resources
Date
Msg-id TYWP286MB2571C92032EE9D1B8F2BFACFEF812@TYWP286MB2571.JPNP286.PROD.OUTLOOK.COM
Whole thread
Responses Re: [PATCH] Report no unpinned buffers as insufficient resources
List 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:


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

pgsql-hackers by date:

Previous
From: shveta malik
Date:
Subject: Re: Persist slot invalidations before publishing them
Next
From: Bertrand Drouvot
Date:
Subject: Re: Add a permission check to pg_stat_get_backend_subxact()