From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org> |
Subject: | Re: Terminating a backend |
Date: | 2008-04-15 13:53:32 |
Message-ID: | 200804151353.m3FDrWB09489@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers pgsql-patches |
Applied.
---------------------------------------------------------------------------
Bruce Momjian wrote:
> oikBruce Momjian wrote:
> > Bruce Momjian wrote:
> > > > > When we get the termination signal, why can't we just set a global
> > > > > boolean, do a query cancel, and in the setjmp() code block check the
> > > > > global and exit --- at that stage we know we have released all locks and
> > > > > can exit cleanly.
> > > >
> > > > I have implemented this idea with the attached patch.
> > >
> > > One problem I have with my patch is that SIGTERM is currently used by
> > > the postmaster to shut down backends. Now because the postmaster knows
> > > that all backend are terminating, it can accept a dirtier shutdown than
> > > one where we are terminating just one backend and the rest are going to
> > > keep running. The new SIGTERM coding is going to exit a backend only in
> > > a place where cancel is checked.
> >
> > I have a idea --- to have pg_terminate_backend() set a PGPROC boolean
> > and then send a query cancel signal to the backend --- the backend can
> > then check the boolean and exit if required. I will work on a new
> > version of this patch tomorrow/Monday.
>
> Updated patch attached. I didn't modify SIGTERM at all but set a PRPROC
> boolean and piggybacked on SIGINT. I think I got the PGPROC locking
> right. I had to split apart pg_signal_backend() so I could do the
> permission and pid checks independent of the signalling, because I
> pg_terminate_backend() needs to check, then set the PGPROC variable,
> then send the signal.
>
> I also added an administration doc mention about when to use
> pg_terminate_backend().
>
> --
> Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
> EnterpriseDB http://enterprisedb.com
>
> + If your life is a hard drive, Christ can be your backup. +
>
> --
> Sent via pgsql-patches mailing list (pgsql-patches(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-patches
--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2008-04-15 13:55:12 | pgsql: Add pg_terminate_backend() to allow terminating only a single |
Previous Message | Bruce Momjian | 2008-04-15 13:51:33 | Re: pulling libpqtypes from queue |
From | Date | Subject | |
---|---|---|---|
Next Message | Merlin Moncure | 2008-04-15 14:32:14 | PQmakeResult patch |
Previous Message | Zeugswetter Andreas OSB SD | 2008-04-15 13:43:14 | Re: [HACKERS] MSVC build broken with perl 5.10 |