Ye olde drop-the-database-you-just-left problem - Mailing list pgsql-hackers

From Tom Lane
Subject Ye olde drop-the-database-you-just-left problem
Date
Msg-id 5380.1180544975@sss.pgh.pa.us
Whole thread Raw
Responses Re: Ye olde drop-the-database-you-just-left problem  (Magnus Hagander <magnus@hagander.net>)
Re: Ye olde drop-the-database-you-just-left problem  (Brian Hurt <bhurt@janestcapital.com>)
Re: Ye olde drop-the-database-you-just-left problem  (Gregory Stark <stark@enterprisedb.com>)
List pgsql-hackers
I just finished giving someone the standard advice to wait a bit before
trying to drop a database that'd just been accessed:
http://archives.postgresql.org/pgsql-general/2007-05/msg01505.php

AFAICT a "real" fix for this would involve making PQfinish() synchronous
(don't return till backend is dead), which doesn't seem like a great
idea.  However, it suddenly struck me that we could probably make most
of the problem go away if we put that same wait into DROP DATABASE
itself --- that is, if we see other backends in the target DB, sleep
for a second or two and then recheck before erroring out.

This isn't bulletproof since under high load the other backend might
not get to quit, but it'd surely reduce the frequency of complaints
a great deal.  And we could take out the ad-hoc sleeps that are done
in (eg) the contrib regression tests.

Thoughts?
        regards, tom lane


pgsql-hackers by date:

Previous
From: Stephen Frost
Date:
Subject: Re: 'Waiting on lock'
Next
From: "Joshua D. Drake"
Date:
Subject: Re: Style of file error messages