I think the inconsistent behaviour reported in this thread gets
resolved with the approach and patch being discussed in [1].
>
> 1. In general, do we need to allow postmaster to send different
> signals to bgworkers for fast and smart shutdowns and let them
> differentiate the two modes(if needed)?
>
Is there any way the bgworkers(for that matter, any postmaster's child
process) knowing that there's a smart shutdown pending? This is
useful, if any of the bgworker(if not parallel workers) want to
differentiate the two modes i.e. smart and fast shutdown modes and
smartly finish of their work.
[1] - https://www.postgresql.org/message-id/469199.1597337108%40sss.pgh.pa.us
With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com