Received: from localhost (pluto.hub.org [200.46.204.4]) by postgresql.org (Postfix) with ESMTP id 854169FB321 for ; Fri, 3 Nov 2006 11:07:00 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.4]) (amavisd-new, port 10024) with ESMTP id 68649-04 for ; Fri, 3 Nov 2006 11:06:50 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from mail01.enterprisedb.com (mail01.enterprisedb.com [63.246.7.168]) by postgresql.org (Postfix) with ESMTP id 051B99FB322 for ; Fri, 3 Nov 2006 11:06:55 -0400 (AST) thread-index: Acb/WbOvdZwChYmSRj6jKCNwdCPB9Q== Received: from [192.168.0.22] ([62.232.55.118]) by mail01.enterprisedb.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.1830); Fri, 3 Nov 2006 10:06:55 -0500 Message-ID: <454B5B0A.7090802@enterprisedb.com> Date: Fri, 03 Nov 2006 15:06:50 +0000 From: "Heikki Linnakangas" X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.2757 Content-class: urn:content-classes:message Importance: normal User-Agent: Thunderbird 1.5.0.7 (X11/20060927) MIME-Version: 1.0 To: "Tom Lane" Cc: "Simon Riggs" , , Subject: Re: "recovering prepared transaction" after serverrestart message References: <27067.1162536485@sss.pgh.pa.us> <1162541215.3587.507.camel@silverbirch.site> <1886.1162564922@sss.pgh.pa.us> In-Reply-To: <1886.1162564922@sss.pgh.pa.us> Content-Type: text/plain; format=flowed; charset="ISO-8859-1" Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 03 Nov 2006 15:06:55.0796 (UTC) FILETIME=[B3A84740:01C6FF59] X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200611/107 X-Sequence-Number: 93569 Tom Lane wrote: > "Simon Riggs" writes: >> We only care when they break, otherwise its just situation normal, yes? > > No, the trouble case is where the XA manager that owns the transaction > has forgotten about it. Yeah, and there's no way the DBMS can detect that. >> Is there a way to see prepared transactions where the original session >> that prepared then has died? Perhaps the message at startup should be >> "you have at least one prepared transaction that needs resolution". > > I am completely baffled by this focus on database startup time. That's > not where the problem is. Agreed. Though one way to have orphaned prepared transactions is to recover from a PITR backup or bring a warm stand-by live. The transaction manager might have committed a transaction after the backup was taken. Recovering from the backup resurrects the transaction again and the TM won't know about it. The problem of orphaned transactions is most likely to occur on a dev/test environment, where the TM is run on a developer's laptop and might be killed and reinstalled or reconfigured at any time. And unfortunately there's also a lot of broken TMs out there that don't recover from crashes properly. I think it's a good idea to at least LOG about prepared transactions at startup. But it would be nice to also have a timeout, after which a big fat WARNING would be printed. I don't believe in killing transactions automatically though, that's a job for the administrator. -- Heikki Linnakangas EnterpriseDB http://www.enterprisedb.com