Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 0013ba2

Browse files
committed
Add wait events for checkpoint delay mechanism.
When MyProc->delayChkptFlags is set to temporarily block phase transitions in a concurrent checkpoint, the checkpointer enters a sleep-poll loop to wait for the flag to be cleared. We should show that as a wait event in the pg_stat_activity view. Reviewed-by: Robert Haas <robertmhaas@gmail.com> Reviewed-by: Michael Paquier <michael@paquier.xyz> Discussion: https://postgr.es/m/CA%2BhUKGL7Whi8iwKbzkbn_1fixH3Yy8aAPz7mfq6Hpj7FeJrKMg%40mail.gmail.com
1 parent 7e1f544 commit 0013ba2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

src/backend/access/transam/xlog.c

+4
Original file line numberDiff line numberDiff line change
@@ -6737,7 +6737,9 @@ CreateCheckPoint(int flags)
67376737
{
67386738
do
67396739
{
6740+
pgstat_report_wait_start(WAIT_EVENT_CHECKPOINT_DELAY_START);
67406741
pg_usleep(10000L); /* wait for 10 msec */
6742+
pgstat_report_wait_end();
67416743
} while (HaveVirtualXIDsDelayingChkpt(vxids, nvxids,
67426744
DELAY_CHKPT_START));
67436745
}
@@ -6750,7 +6752,9 @@ CreateCheckPoint(int flags)
67506752
{
67516753
do
67526754
{
6755+
pgstat_report_wait_start(WAIT_EVENT_CHECKPOINT_DELAY_COMPLETE);
67536756
pg_usleep(10000L); /* wait for 10 msec */
6757+
pgstat_report_wait_end();
67546758
} while (HaveVirtualXIDsDelayingChkpt(vxids, nvxids,
67556759
DELAY_CHKPT_COMPLETE));
67566760
}

src/backend/utils/activity/wait_event_names.txt

+2
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ BGWORKER_SHUTDOWN "Waiting for background worker to shut down."
9797
BGWORKER_STARTUP "Waiting for background worker to start up."
9898
BTREE_PAGE "Waiting for the page number needed to continue a parallel B-tree scan to become available."
9999
BUFFER_IO "Waiting for buffer I/O to complete."
100+
CHECKPOINT_DELAY_COMPLETE "Waiting for a backend that blocks a checkpoint from completing."
101+
CHECKPOINT_DELAY_START "Waiting for a backend that blocks a checkpoint from starting."
100102
CHECKPOINT_DONE "Waiting for a checkpoint to complete."
101103
CHECKPOINT_START "Waiting for a checkpoint to start."
102104
EXECUTE_GATHER "Waiting for activity from a child process while executing a <literal>Gather</literal> plan node."

0 commit comments

Comments
 (0)