Re: DROP DATABASE and prepared xacts

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
Cc: alvherre(at)alvh(dot)no-ip(dot)org, Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: DROP DATABASE and prepared xacts
Date: 2007-02-13 19:56:33
Message-ID: 200702131956.l1DJuXh05755@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Added to TODO:

* Improve failure message when DROP DATABASE is used on a database that
has prepared transactions

---------------------------------------------------------------------------

Heikki Linnakangas wrote:
> 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
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 3: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/docs/faq

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2007-02-13 19:59:12 Re: cuckoo is hung during regression test
Previous Message Andrew Hammond 2007-02-13 19:29:17 Re: Missing directory when building 8.2.3-base