public inbox for [email protected]
help / color / mirror / Atom feedFrom: Dennis White <[email protected]>
To: Tom Lane <[email protected]>
Cc: Laurenz Albe <[email protected]>
Cc: pgsql-general <[email protected]>
Subject: Re: Can a long running procedure detect when smart shutdown is pending?
Date: Sat, 6 Jul 2024 13:17:08 -0400
Message-ID: <CAE=rie9qABQffaU+ZQ2FnDtK3Sf9KaG4uruzFYR3AWCqJ=Va5g@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <CAE=rie-ZcNzzt_8bKrN-7fnnbYL-ofbne4jNurd3HjjW2j9Yaw@mail.gmail.com>
<[email protected]>
<[email protected]>
Thanks everyone. A more direct way to check via a sql function would be
better but I suppose the dblink extension method will work.
Thanks again,
Dennis
On Sat, Jul 6, 2024 at 9:38 AM Tom Lane <[email protected]> wrote:
> Laurenz Albe <[email protected]> writes:
> > On Fri, 2024-07-05 at 14:12 -0400, Dennis White wrote:
> >> My project's DB has a mutli-step stored procedure using Transaction
> Control that may take 30 minutes or more to complete.
> >> I am curious if there is a way to make it more smart shutdown friendly
> so it can stop between steps?
>
> > I don't think there is a direct way to do that in SQL; that would
> require a new
> > system function that exposes canAcceptConnections() in SQL.
>
> It's worse than that: the state variables involved are local to the
> postmaster, so you wouldn't get the right answer in a backend even
> if the function were reachable.
>
> > What you could do is use the dblink extension to connect to the local
> database.
> > If you get an error "the database system is shutting down", there is a
> smart
> > shutdown in progress.
>
> This'd probably work. Ugly, but ...
>
> regards, tom lane
>
view thread (5+ messages)
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: [email protected]
Cc: [email protected], [email protected], [email protected], [email protected]
Subject: Re: Can a long running procedure detect when smart shutdown is pending?
In-Reply-To: <CAE=rie9qABQffaU+ZQ2FnDtK3Sf9KaG4uruzFYR3AWCqJ=Va5g@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox