Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d24s7-00014F-QI for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Apr 2017 23:55:23 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1d24s7-0002DK-4Q for pgsql-hackers@arkaria.postgresql.org; Sat, 22 Apr 2017 23:55:23 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d24s6-0002D0-3E for pgsql-hackers@postgreSQL.org; Sat, 22 Apr 2017 23:55:22 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1d24s3-0005a2-5p for pgsql-hackers@postgreSQL.org; Sat, 22 Apr 2017 23:55:20 +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 v3MNtIb7020111 for ; Sat, 22 Apr 2017 19:55:18 -0400 From: Tom Lane To: pgsql-hackers@postgreSQL.org Subject: StandbyRecoverPreparedTransactions recovers subtrans links incorrectly MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <20109.1492905318.1@sss.pgh.pa.us> Date: Sat, 22 Apr 2017 19:55:18 -0400 Message-ID: <20110.1492905318@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-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Now that we've got consistent failure reports about the 009_twophase.pl recovery test, I set out to find out why it's failing. It looks to me like the reason is that this (twophase.c:2145): SubTransSetParent(xid, subxid, overwriteOK); ought to be this: SubTransSetParent(subxid, xid, overwriteOK); because the definition of SubTransSetParent is void SubTransSetParent(TransactionId xid, TransactionId parent, bool overwriteOK) not the other way 'round. While "git blame" blames this line on the recent commit 728bd991c, that just moved the call from somewhere else. AFAICS this has actually been wrong since StandbyRecoverPreparedTransactions was written, in 361bd1662 of 2010-04-13. It's not clear to me how much potential this has to create user data corruption, but it doesn't look good at first glance. Discuss. Also, when I fix that, it gets further but still crashes at the same Assert in SubTransSetParent. The proximate cause this time seems to be that RecoverPreparedTransactions's calculation of overwriteOK is wrong: it's computing that as "false", but in reality the subtrans link in question has already been set. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers