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
pull/256/head
Heikki Linnakangas 1 week ago
parent f231a4e8c7
commit 3cb5808bd1
  1. 2
      src/backend/access/transam/xlog.c
  2. 1
      src/backend/utils/activity/wait_event_names.txt

@ -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

@ -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 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)."

Loading…
Cancel
Save