Re: DROP DATABASE and prepared xacts - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: DROP DATABASE and prepared xacts
Date
Msg-id 45D09530.3070601@enterprisedb.com
Whole thread Raw
In response to DROP DATABASE and prepared xacts  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Responses Re: DROP DATABASE and prepared xacts  (Tom Lane <tgl@sss.pgh.pa.us>)
Re: DROP DATABASE and prepared xacts  (Bruce Momjian <bruce@momjian.us>)
List pgsql-hackers
Alvaro Herrera wrote:
> I think we should set things up so that prepared transactions are
> dropped when they concern a database being dropped.  Opinions?

Agreed, if you want to drop the database, you don't care about the 
transactions in it anymore.

It seems straightforward to implement. We'll need a version of
FinishPreparedTransaction that takes an xid instead of a global
transaction id. Then that needs to be called at roughly the same time as
DatabaseCancelAutovacuumActivity. Preferably there isn't a wide window 
between rolling back the prepared transactions and committing to 
dropping the database...

I just realized that you can prepare a transaction in one database, 
connect to another database in the same cluster, and issue a "COMMIT 
PREPARED" there. At least NOTIFY/LISTEN gets confused when you do that, 
and sends the notification to the another database, not the one where 
the original transaction was running :(.

Do we consider committing a transaction from another database a feature, 
and fix NOTIFY/LISTEN, or should COMMIT PREPARED throw an error if 
you're not connected to the same database?

Actually, I think we should completely separate the namespaces of the 
global transaction identifiers, so that you could use the same gid in 
two different databases without a conflict.

--   Heikki Linnakangas  EnterpriseDB   http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: DROP DATABASE and prepared xacts
Next
From: Heikki Linnakangas
Date:
Subject: Re: HOT for PostgreSQL 8.3