Re: DROP DATABASE and prepared xacts

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: alvherre(at)alvh(dot)no-ip(dot)org
Cc: Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DROP DATABASE and prepared xacts
Date: 2007-02-12 16:26:24
Message-ID: 45D09530.3070601@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2007-02-12 17:23:30 Re: HOT for PostgreSQL 8.3
Previous Message Tom Lane 2007-02-12 16:23:35 Re: DROP DATABASE and prepared xacts