Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XARqW-0008Cv-Ev for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Jul 2014 22:50:44 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XARqV-0004Ll-RC for pgsql-bugs@arkaria.postgresql.org; Thu, 24 Jul 2014 22:50:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XARqU-0004Ld-RV for pgsql-bugs@postgresql.org; Thu, 24 Jul 2014 22:50:42 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XARqQ-0004sy-Vx for pgsql-bugs@postgresql.org; Thu, 24 Jul 2014 22:50:41 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s6OMoWwN021621; Thu, 24 Jul 2014 18:50:32 -0400 From: Tom Lane To: Andres Freund cc: s.zuban@gmail.com, pgsql-bugs@postgresql.org, Heikki Linnakangas Subject: Re: BUG #11032: Prepared transactions do not update pg_last_xact_replay_timestamp() anymore In-reply-to: <20140724223459.GI16857@alap3.anarazel.de> References: <20140724191127.32089.82261@wrigleys.postgresql.org> <20429.1406238373@sss.pgh.pa.us> <20140724215743.GG16857@alap3.anarazel.de> <21266.1406241129@sss.pgh.pa.us> <20140724223459.GI16857@alap3.anarazel.de> Comments: In-reply-to Andres Freund message dated "Fri, 25 Jul 2014 00:34:59 +0200" Date: Thu, 24 Jul 2014 18:50:32 -0400 Message-ID: <21620.1406242232@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Andres Freund writes: > Afaics before the commit a LockGXact() did a GetTopTransactionId(), > afterwards it doesn't anymore. That'd fit, right? Ah, I think you've got it. Now I'm worried. I have a very vague recollection that that behavior (forcing our own COMMIT to be written after a COMMIT PREPARED) was intentional. I don't recall exactly why though. xact.h points out /* * COMMIT_PREPARED and ABORT_PREPARED are identical to COMMIT/ABORT records * except that we have to store the XID of the prepared transaction explicitly * --- the XID in the record header will be for the transaction doing the * COMMIT PREPARED or ABORT PREPARED command. */ and what this change means is that there isn't actually any valid XID in the record header, which at least means that comment needs an update. But I'm concerned about the knock-on aspects of that. In particular I wonder if we were expecting commit of the surrounding transaction to result in a WAL flush or anything like that. The proposal you made recently to not sync non-XID-assigning WAL records would affect this. As far as the timestamp aspects go, I wonder if we were thinking that commit/abort prepared might contain stale timestamps by design. They don't --- in the current coding, the timestamp is the time of creating the WAL record, not of the prepare --- but it's not that hard to imagine that time-of-prepare might have been the original intent. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs