Re: Parallel query hangs after a smart shutdown is issued - Mailing list pgsql-hackers

From Thomas Munro
Subject Re: Parallel query hangs after a smart shutdown is issued
Date
Msg-id CA+hUKGLPh9NS270bXhOYLnFDVhzW6cjKq5tOT4NL4k6awjbwzg@mail.gmail.com
Whole thread Raw
In response to Re: Parallel query hangs after a smart shutdown is issued  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Parallel query hangs after a smart shutdown is issued
List pgsql-hackers
On Thu, Aug 13, 2020 at 2:37 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I experimented with separating the shutdown-in-progress state into a
> separate variable, letting us actually reduce not increase the number of
> pmStates.  This way, PM_RUN and other states still apply until we're
> ready to pull the shutdown trigger, so that we don't need to complicate
> state-based decisions about launching auxiliary processes.  This patch
> also unifies the signal-sending for the smart and fast shutdown paths,
> which seems like a nice improvement.  I kind of like this, though I'm not
> in love with the particular variable name I used here (smartShutState).

Makes sense.  I tested this version on a primary and a replica and
verified that parallel workers launch, but I saw that autovacuum
workers still can't start without something like this:

@@ -2463,7 +2463,8 @@ canAcceptConnections(int backend_type)
         * be returned until we have checked for too many children.
         */
        if (smartShutState != SMART_NORMAL_USAGE &&
-               backend_type != BACKEND_TYPE_BGWORKER)
+               backend_type != BACKEND_TYPE_BGWORKER &&
+               backend_type != BACKEND_TYPE_AUTOVAC)
        {
                if (smartShutState == SMART_SUPERUSER_ONLY)
                        result = CAC_WAITBACKUP;        /* allow
superusers only */
@@ -2471,7 +2472,8 @@ canAcceptConnections(int backend_type)
                        return CAC_SHUTDOWN;    /* shutdown is pending */
        }
        if (pmState != PM_RUN &&
-               backend_type != BACKEND_TYPE_BGWORKER)
+               backend_type != BACKEND_TYPE_BGWORKER &&
+               backend_type != BACKEND_TYPE_AUTOVAC)
        {
                if (Shutdown > NoShutdown)
                        return CAC_SHUTDOWN;    /* shutdown is pending */



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Switch to multi-inserts for pg_depend
Next
From: Tom Lane
Date:
Subject: Re: Parallel query hangs after a smart shutdown is issued