Report shared buffer exhaustion as insufficient resources

When all shared buffers examined are pinned, a query can fail with
"no unpinned buffers available". This can happen when shared_buffers
is too small for the workload, but the error was reported as an internal
error, making a resource shortage look like a server bug.

Replace elog() with ereport() to report this condition with SQLSTATE
53000 (insufficient_resources) instead of XX000 (internal_error),
matching the corresponding local-buffer error. Reword both messages
to clarify whether shared or local buffers are involved.

Author: Ma Xueting <[email protected]>
Reviewed-by: Pierre Forstmann <[email protected]>
Reviewed-by: Matthias van de Meent <[email protected]>
Reviewed-by: solai v <[email protected]>
Reviewed-by: Fujii Masao <[email protected]>
Discussion: 
https://postgr.es/m/tywp286mb2571c92032ee9d1b8f2bfacfef...@tywp286mb2571.jpnp286.prod.outlook.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/4b97fd15fb497d2810a29cd30bfacd89400b596c

Modified Files
--------------
src/backend/storage/buffer/freelist.c | 4 +++-
src/backend/storage/buffer/localbuf.c | 2 +-
src/test/regress/expected/temp.out    | 4 ++--
3 files changed, 6 insertions(+), 4 deletions(-)

Reply via email to