Re: 'Shutdown <= SmartShutdown' check while launching processes in postmaster.

From: shveta malik <shveta(dot)malik(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, shveta malik <shveta(dot)malik(at)gmail(dot)com>
Subject: Re: 'Shutdown <= SmartShutdown' check while launching processes in postmaster.
Date: 2024-02-21 10:08:10
Message-ID: CAJpy0uAmkha_iBcALc-XeL0qLz=qjwO_Qi0ffwG0xJ=AXHBF6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Feb 21, 2024 at 10:01 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> shveta malik <shveta(dot)malik(at)gmail(dot)com> writes:
> > I would like to know that why we have 'Shutdown <= SmartShutdown'
> > check before launching few processes (WalReceiver, WalSummarizer,
> > AutoVacuum worker) while rest of the processes (BGWriter, WalWriter,
> > Checkpointer, Archiver etc) do not have any such check. If I have to
> > launch a new process, what shall be the criteria to decide if I need
> > this check?
>
> Children that are stopped by the "if (pmState == PM_STOP_BACKENDS)"
> stanza in PostmasterStateMachine should not be allowed to start
> again later if we are trying to shut down. (But "smart" shutdown
> doesn't enforce that, since it's a very weak state that only
> prohibits new client sessions.) The processes that are allowed
> to continue beyond that point are ones that are needed to perform
> the shutdown checkpoint, or useful to make it finish faster.

Thank you for providing the details. It clarifies the situation. Do
you think it would be beneficial to include this as a code comment in
postmaster.c to simplify understanding for future readers?

thanks
Shveta

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2024-02-21 10:19:53 Re: POC: GROUP BY optimization
Previous Message Dilip Kumar 2024-02-21 09:55:13 Re: logical decoding and replication of sequences, take 2