pgsql: Limit checkpointer requests queue size - Mailing list pgsql-committers

From Alexander Korotkov
Subject pgsql: Limit checkpointer requests queue size
Date
Msg-id E1ug0ZP-000ywM-2p@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Limit checkpointer requests queue size

If the number of sync requests is big enough, the palloc() call in
AbsorbSyncRequests() will attempt to allocate more than 1 GB of memory,
resulting in failure.  This can lead to an infinite loop in the checkpointer
process, as it repeatedly fails to absorb the pending requests.

This commit limits the checkpointer requests queue size to 10M items. In
addition to preventing the palloc() failure, this change helps to avoid long
queue processing time.

Also, this commit is for backpathing only.  The master branch receives
a more invasive yet comprehensive fix for this problem.

Discussion: https://postgr.es/m/db4534f83a22a29ab5ee2566ad86ca92%40postgrespro.ru
Backpatch-through: 13

Branch
------
REL_13_STABLE

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

Modified Files
--------------
src/backend/postmaster/checkpointer.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)


pgsql-committers by date:

Previous
From: Alexander Korotkov
Date:
Subject: pgsql: Limit checkpointer requests queue size
Next
From: Michael Paquier
Date:
Subject: pgsql: Fix performance regression with flush of pending fixed-numbered