aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/backend/access/transam/xlog.c7
-rw-r--r--src/backend/postmaster/checkpointer.c4
2 files changed, 11 insertions, 0 deletions
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 06235073ce5..7aaba6203ae 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -6701,6 +6701,12 @@ CreateCheckPoint(int flags)
{
do
{
+ /*
+ * Keep absorbing fsync requests while we wait. There could even
+ * be a deadlock if we don't, if the process that prevents the
+ * checkpoint is trying to add a request to the queue.
+ */
+ AbsorbSyncRequests();
pg_usleep(10000L); /* wait for 10 msec */
} while (HaveVirtualXIDsDelayingChkpt(vxids, nvxids,
DELAY_CHKPT_START));
@@ -6714,6 +6720,7 @@ CreateCheckPoint(int flags)
{
do
{
+ AbsorbSyncRequests();
pg_usleep(10000L); /* wait for 10 msec */
} while (HaveVirtualXIDsDelayingChkpt(vxids, nvxids,
DELAY_CHKPT_COMPLETE));
diff --git a/src/backend/postmaster/checkpointer.c b/src/backend/postmaster/checkpointer.c
index ace9893d957..f482f6423d1 100644
--- a/src/backend/postmaster/checkpointer.c
+++ b/src/backend/postmaster/checkpointer.c
@@ -1171,6 +1171,10 @@ CompactCheckpointerRequestQueue(void)
/* must hold CheckpointerCommLock in exclusive mode */
Assert(LWLockHeldByMe(CheckpointerCommLock));
+ /* Avoid memory allocations in a critical section. */
+ if (CritSectionCount > 0)
+ return false;
+
/* Initialize skip_slot array */
skip_slot = palloc0(sizeof(bool) * CheckpointerShmem->num_requests);