Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Masahiro Ikeda <ikedamsh(at)oss(dot)nttdata(dot)com>
Cc: kuroda(dot)hayato(at)fujitsu(dot)com, Zhihong Yu <zyu(at)yugabyte(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.
Date: 2021-03-23 06:50:46
Message-ID: e5a982a5-8bb4-5a10-cf9a-40dd1921bdb5@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021/03/23 14:54, Masahiro Ikeda wrote:
> Thanks for your comments. I agreed your concern and suggestion.
> Additionally, we need to consider system shutdown cycle too as
> CheckpointerMain()'s comment said.
>
> ```
> * Note: we deliberately ignore SIGTERM, because during a standard Unix
> * system shutdown cycle, init will SIGTERM all processes at once. We
> * want to wait for the backends to exit, whereupon the postmaster will
> * tell us it's okay to shut down (via SIGUSR2)
> ```

Good catch!

> I changed the signal from SIGTERM to SIGUSR2 and add the comments why SIGUSR2
> is used.
> (v6-0001-pgstat_avoid_writing_on_sigquit.patch)

Thanks for updating the patch!

+ * The statistics collector is started by the postmaster as soon as the
+ * startup subprocess finishes.

This comment needs to be updated? Because the stats collector can
be invoked when the startup process sends PMSIGNAL_BEGIN_HOT_STANDBY
signal.

This fact makes me wonder that if we collect the statistics about WAL writing
from walreceiver as we discussed in other thread, the stats collector should
be invoked at more earlier stage. IIUC walreceiver can be invoked before
PMSIGNAL_BEGIN_HOT_STANDBY is sent.

Regards,

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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Masahiko Sawada 2021-03-23 06:53:18 Re: New IndexAM API controlling index vacuum strategies
Previous Message Andrei Zubkov 2021-03-23 06:50:16 Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements