Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)
Date: 1999-06-12 20:41:32
Message-ID: Pine.GSO.3.96.SK.990613002221.29126D-100000@ra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 12 Jun 1999, Tom Lane wrote:

> Date: Sat, 12 Jun 1999 16:04:30 -0400
> From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
> To: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
> Cc: hackers(at)postgreSQL(dot)org
> Subject: Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)
>
> Oleg Bartunov <oleg(at)sai(dot)msu(dot)su> writes:
> > I don't know is it DBI/DBD problem or backend must close
> > all connections to DB when it destroyed.
>
> You cannot destroy a DB while there are backends connected to it;
> all hell breaks loose if you do. See thread "How to destroy your entire
> Postgres installation" in pg-hackers in late Sept. 1998.

I did it without any problem :-)

>
> The correct fix is to add an interlock that prevents "destroydb" when
> there are connected backends. I don't know just how that might be done,
> however.

I'm not sure preventing "destroydb" is a good idea. Imagine some
user connects to db (via psql) and hold it for a weekend.
You will not be able to do some dbadmin work ?
What's wrong if backend close connection, cleanup buffers etc.
and inform client that db was destroyed. Client could decide -
exit or try to reestablish connection. If you recreate that db
nothing will happens.

>
> There should be a TODO item for this, but I don't see one:
> * Prevent destroydb when there are backends active in that database

The problem would be worse in case of 24*7 life-cycle of Web-database
connectivity if you decide "prevent destroydb" feature !
I prefer to allow destroydb but close all active connections with
this db and inform client. Client will decide what to do.
As I understand DBI/DBD is already ready for such behaivour because
it has ping method. I'm no sure about psql.

Oleg

>

> regards, tom lane
>

_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 1999-06-12 20:49:25 Re: [HACKERS] new patches
Previous Message Oleg Bartunov 1999-06-12 20:04:43 Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)