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 e0485d7e-73a3-e5c5-c848-3ac2022f3e56@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.
List pgsql-hackers

On 2021/03/20 13:40, Masahiro Ikeda wrote:
> Sorry, there is no evidence we should call it.
> I thought that to call FreeWaitEventSet() is a manner after using
> CreateWaitEventSet() and the performance impact to call it seems to be too small.
> 
> (Please let me know if my understanding is wrong.)
> The reason why I said this is a manner because I thought it's no problem
> even without calling FreeWaitEventSet() before the process exits regardless
> of fast or immediate shutdown. Since the "WaitEventSet *wes" is a process local resource,
> this will be released by OS even if FreeWaitEventSet() is not called.
> 
> I'm now changing my mind to skip it is better because the code can be simpler and,
> it's unimportant for the above reason especially when the immediate shutdown is
> requested which is a bad manner itself.

Thanks for explaining this! So you're thinking that v3 patch should be chosen?
Probably some review comments I posted upthread need to be applied to
v3 patch, e.g., rename of SignalHandlerForUnsafeExit() function.


> BTW, the SysLoggerMain() create the WaitEventSet, but it didn't call FreeWaitEventSet().
> Is it better to call FreeWaitEventSet() before exiting too?

Yes if which could cause actual issue. Otherwise I don't have strong
reason to do that for now..

Regards,

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



pgsql-hackers by date:

Previous
From: "Drouvot, Bertrand"
Date:
Subject: Re: Minimal logical decoding on standbys
Next
From: Laurenz Albe
Date:
Subject: Re: Disable WAL logging to speed up data loading