pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Subject: wait event and archive_command
Date: Thu, 21 Oct 2021 22:57:50 +0900
Message-ID: <4ca4f920-6b48-638d-08b2-93598356f5d3@oss.nttdata.com> (raw)

Hi,

I'd like to propose to add new wait event reported while archiver process
is executing archive_command. This would be helpful to observe
what archiver is doing and check whether it has some troubles or not.
Thought? PoC patch attached.

Also how about adding wait events for other commands like
archive_cleanup_command, restore_command and recovery_end_command?

Regards,

-- 
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

Attachments:

wait_event_for_archive_command_v1.patch (text/plain, 2.1K) download diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index 3173ec2566..13c7e991d0 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1569,7 +1569,12 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser <entry>Waiting for subplan nodes of an <literal>Append</literal> plan node to be ready.</entry> </row> - <row> + <row> + <entry><literal>ArchiveCommand</literal></entry> + <entry>Waiting for <xref linkend="guc-archive-command"/> to + complete.</entry> + </row> + <row> <entry><literal>BackendTermination</literal></entry> <entry>Waiting for the termination of another backend.</entry> </row> diff --git a/src/backend/postmaster/pgarch.c b/src/backend/postmaster/pgarch.c index 74a7d7c4d0..2201f069ea 100644 --- a/src/backend/postmaster/pgarch.c +++ b/src/backend/postmaster/pgarch.c @@ -515,7 +515,10 @@ pgarch_archiveXlog(char *xlog) snprintf(activitymsg, sizeof(activitymsg), "archiving %s", xlog); set_ps_display(activitymsg); + pgstat_report_wait_start(WAIT_EVENT_ARCHIVE_COMMAND); rc = system(xlogarchcmd); + pgstat_report_wait_end(); + if (rc != 0) { /* diff --git a/src/backend/utils/activity/wait_event.c b/src/backend/utils/activity/wait_event.c index 4a5b7502f5..d8e3688ab5 100644 --- a/src/backend/utils/activity/wait_event.c +++ b/src/backend/utils/activity/wait_event.c @@ -313,6 +313,9 @@ pgstat_get_wait_ipc(WaitEventIPC w) case WAIT_EVENT_APPEND_READY: event_name = "AppendReady"; break; + case WAIT_EVENT_ARCHIVE_COMMAND: + event_name = "ArchiveCommand"; + break; case WAIT_EVENT_BACKEND_TERMINATION: event_name = "BackendTermination"; break; diff --git a/src/include/utils/wait_event.h b/src/include/utils/wait_event.h index c22142365f..2edfdd3e51 100644 --- a/src/include/utils/wait_event.h +++ b/src/include/utils/wait_event.h @@ -80,6 +80,7 @@ typedef enum typedef enum { WAIT_EVENT_APPEND_READY = PG_WAIT_IPC, + WAIT_EVENT_ARCHIVE_COMMAND, WAIT_EVENT_BACKEND_TERMINATION, WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE, WAIT_EVENT_BGWORKER_SHUTDOWN,

view thread (15+ messages)  latest in thread

Message-ID: <4ca4f920-6b48-638d-08b2-93598356f5d3@oss.nttdata.com>
Permalink:  ../4ca4f920-6b48-638d-08b2-93598356f5d3@oss.nttdata.com/
Also on:    postgresql.org/message-id/4ca4f920-6b48-638d-08b2-93598356f5d3@oss.nttdata.com

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: masao.fujii@oss.nttdata.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: wait event and archive_command
  In-Reply-To: <4ca4f920-6b48-638d-08b2-93598356f5d3@oss.nttdata.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox