Skip to content

Commit 3cb5808

Browse files
committed
Add wait event for the group commit delay before WAL flush
Author: Rafia Sabih <rafia.pghackers@gmail.com> Reviewed-by: Sami Imseih <samimseih@gmail.com> Discussion: https://www.postgresql.org/message-id/CA%2BFpmFf-hWXtrC0Q3Cr_Xo78zuP_M_VC5xgWPOYOkwqOD0T8eg@mail.gmail.com
1 parent f231a4e commit 3cb5808

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2884,7 +2884,9 @@ XLogFlush(XLogRecPtr record)
28842884
if (CommitDelay > 0 && enableFsync &&
28852885
MinimumActiveBackends(CommitSiblings))
28862886
{
2887+
pgstat_report_wait_start(WAIT_EVENT_COMMIT_DELAY);
28872888
pg_usleep(CommitDelay);
2889+
pgstat_report_wait_end();
28882890

28892891
/*
28902892
* Re-check how far we can now flush the WAL. It's generally not

src/backend/utils/activity/wait_event_names.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,7 @@ Section: ClassName - WaitEventTimeout
175175

176176
BASE_BACKUP_THROTTLE "Waiting during base backup when throttling activity."
177177
CHECKPOINT_WRITE_DELAY "Waiting between writes while performing a checkpoint."
178+
COMMIT_DELAY "Waiting for commit delay before WAL flush."
178179
PG_SLEEP "Waiting due to a call to <function>pg_sleep</function> or a sibling function."
179180
RECOVERY_APPLY_DELAY "Waiting to apply WAL during recovery because of a delay setting."
180181
RECOVERY_RETRIEVE_RETRY_INTERVAL "Waiting during recovery when WAL data is not available from any source (<filename>pg_wal</filename>, archive or stream)."

0 commit comments

Comments
 (0)