0002-Add-WAIT_EVENT-for-CommitDelay.patch
application/octet-stream
Filename: 0002-Add-WAIT_EVENT-for-CommitDelay.patch
Type: application/octet-stream
Part: 0
Message:
Re: Add wait event for CommitDelay
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch 0002
Subject: Add wait event for CommitDelay
| File | + | − |
|---|---|---|
| src/backend/access/transam/xlog.c | 2 | 0 |
| src/backend/utils/activity/wait_event_names.txt | 1 | 0 |
From e6bac7a4a7de597dada842834e510464631654a2 Mon Sep 17 00:00:00 2001
From: Rafia Sabih <rafia.sabih@cybertec.at>
Date: Mon, 8 Dec 2025 16:15:57 +0100
Subject: [PATCH] Add wait event for CommitDelay
---
src/backend/access/transam/xlog.c | 2 ++
src/backend/utils/activity/wait_event_names.txt | 1 +
2 files changed, 3 insertions(+)
diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c
index 22d0a2e8c3a..76a3a875679 100644
--- a/src/backend/access/transam/xlog.c
+++ b/src/backend/access/transam/xlog.c
@@ -2884,7 +2884,9 @@ XLogFlush(XLogRecPtr record)
if (CommitDelay > 0 && enableFsync &&
MinimumActiveBackends(CommitSiblings))
{
+ pgstat_report_wait_start(WAIT_EVENT_COMMIT_DELAY);
pg_usleep(CommitDelay);
+ pgstat_report_wait_end();
/*
* Re-check how far we can now flush the WAL. It's generally not
diff --git a/src/backend/utils/activity/wait_event_names.txt b/src/backend/utils/activity/wait_event_names.txt
index 1e5e368a5dc..469fa365636 100644
--- a/src/backend/utils/activity/wait_event_names.txt
+++ b/src/backend/utils/activity/wait_event_names.txt
@@ -175,6 +175,7 @@ Section: ClassName - WaitEventTimeout
BASE_BACKUP_THROTTLE "Waiting during base backup when throttling activity."
CHECKPOINT_WRITE_DELAY "Waiting between writes while performing a checkpoint."
+COMMIT_DELAY "Waiting for the commit delay before WAL flush."
PG_SLEEP "Waiting due to a call to <function>pg_sleep</function> or a sibling function."
RECOVERY_APPLY_DELAY "Waiting to apply WAL during recovery because of a delay setting."
RECOVERY_RETRIEVE_RETRY_INTERVAL "Waiting during recovery when WAL data is not available from any source (<filename>pg_wal</filename>, archive or stream)."
--
2.39.5 (Apple Git-154)