pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Fujii Masao <masao.fujii@oss.nttdata.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Wait event that should be reported while waiting for WAL archiving to finish
Date: Mon, 17 Feb 2020 16:30:00 +0900
Message-ID: <61477660-dded-2550-b101-c76a2f864806@oss.nttdata.com> (raw)
In-Reply-To: <CA+Tgmoa3BVNJ+LVrytUrsK+MtxEogc_jurDgJ=rkMAEt06Hk6Q@mail.gmail.com>
References: <f0651f8c-9c96-9f29-0ff9-80414a15308a@oss.nttdata.com>
	<20200213032804.GB1520@paquier.xyz>
	<949931aa-4ed4-d867-a7b5-de9c02b2292b@oss.nttdata.com>
	<20200213073035.GI1520@paquier.xyz>
	<eb1287bd-64ee-07a5-057e-710d93e7f39e@oss.nttdata.com>
	<CA+Tgmoa3BVNJ+LVrytUrsK+MtxEogc_jurDgJ=rkMAEt06Hk6Q@mail.gmail.com>



On 2020/02/14 23:43, Robert Haas wrote:
> On Thu, Feb 13, 2020 at 10:47 PM Fujii Masao
> <masao.fujii@oss.nttdata.com> wrote:
>> Fixed. Thanks for the review!
> 
> I think it would be safer to just report the wait event during
> pg_usleep(1000000L) rather than putting those calls around the whole
> loop. It does not seem impossible that ereport() or
> CHECK_FOR_INTERRUPTS() could do something that reports a wait event
> internally.

OK, so I attached the updated version of the patch.
Thanks for the review!

Regards,

-- 
Fujii Masao
NTT DATA CORPORATION
Advanced Platform Technology Group
Research and Development Headquarters

Attachments:

wait_event_wal_archive_v3.patch (text/plain, 2.2K) download diff --git a/doc/src/sgml/monitoring.sgml b/doc/src/sgml/monitoring.sgml index a9f6ee6e32..2f88b41529 100644 --- a/doc/src/sgml/monitoring.sgml +++ b/doc/src/sgml/monitoring.sgml @@ -1335,7 +1335,11 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser <entry>Waiting in an extension.</entry> </row> <row> - <entry morerows="36"><literal>IPC</literal></entry> + <entry morerows="37"><literal>IPC</literal></entry> + <entry><literal>BackupWaitWalArchive</literal></entry> + <entry>Waiting for WAL files required for the backup to be successfully archived.</entry> + </row> + <row> <entry><literal>BgWorkerShutdown</literal></entry> <entry>Waiting for background worker to shut down.</entry> </row> diff --git a/src/backend/access/transam/xlog.c b/src/backend/access/transam/xlog.c index 3813eadfb4..dce0f3b041 100644 --- a/src/backend/access/transam/xlog.c +++ b/src/backend/access/transam/xlog.c @@ -11107,7 +11107,9 @@ do_pg_stop_backup(char *labelfile, bool waitforarchive, TimeLineID *stoptli_p) reported_waiting = true; } + pgstat_report_wait_start(WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE); pg_usleep(1000000L); + pgstat_report_wait_end(); if (++waits >= seconds_before_warning) { diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c index 59dc4f31ab..6e7a57b1b7 100644 --- a/src/backend/postmaster/pgstat.c +++ b/src/backend/postmaster/pgstat.c @@ -3737,6 +3737,9 @@ pgstat_get_wait_ipc(WaitEventIPC w) switch (w) { + case WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE: + event_name = "BackupWaitWalArchive"; + break; case WAIT_EVENT_BGWORKER_SHUTDOWN: event_name = "BgWorkerShutdown"; break; diff --git a/src/include/pgstat.h b/src/include/pgstat.h index 3a65a51696..20313f1e32 100644 --- a/src/include/pgstat.h +++ b/src/include/pgstat.h @@ -817,7 +817,8 @@ typedef enum */ typedef enum { - WAIT_EVENT_BGWORKER_SHUTDOWN = PG_WAIT_IPC, + WAIT_EVENT_BACKUP_WAIT_WAL_ARCHIVE = PG_WAIT_IPC, + WAIT_EVENT_BGWORKER_SHUTDOWN, WAIT_EVENT_BGWORKER_STARTUP, WAIT_EVENT_BTREE_PAGE, WAIT_EVENT_CLOG_GROUP_UPDATE,

view thread (16+ messages)  latest in thread

Message-ID: <61477660-dded-2550-b101-c76a2f864806@oss.nttdata.com>
Permalink:  ../61477660-dded-2550-b101-c76a2f864806@oss.nttdata.com/
Also on:    postgresql.org/message-id/61477660-dded-2550-b101-c76a2f864806@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, robertmhaas@gmail.com, michael@paquier.xyz
  Subject: Re: Wait event that should be reported while waiting for WAL archiving to finish
  In-Reply-To: <61477660-dded-2550-b101-c76a2f864806@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