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

From Oleg Bartunov
Subject Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)
Date
Msg-id Pine.GSO.3.96.SK.990613002221.29126D-100000@ra
Whole thread Raw
In response to Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)
List pgsql-hackers
On Sat, 12 Jun 1999, Tom Lane wrote:

> Date: Sat, 12 Jun 1999 16:04:30 -0400
> From: Tom Lane <tgl@sss.pgh.pa.us>
> To: Oleg Bartunov <oleg@sai.msu.su>
> Cc: hackers@postgreSQL.org
> Subject: Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg) 
> 
> Oleg Bartunov <oleg@sai.msu.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@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] destroydb doesn't close connection with client (httpd <-> pg)
Next
From: Tom Lane
Date:
Subject: Re: [HACKERS] new patches