Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested. - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.
Date
Msg-id e5a982a5-8bb4-5a10-cf9a-40dd1921bdb5@oss.nttdata.com
Whole thread Raw
In response to Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.  (Masahiro Ikeda <ikedamsh@oss.nttdata.com>)
Responses Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.
Re: make the stats collector shutdown without writing the statsfiles if the immediate shutdown is requested.
List 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



pgsql-hackers by date:

Previous
From: Andrei Zubkov
Date:
Subject: Re: [PATCH] Tracking statements entry timestamp in pg_stat_statements
Next
From: Masahiko Sawada
Date:
Subject: Re: New IndexAM API controlling index vacuum strategies