Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wl1Mw-0003Yo-Ef for pgsql-hackers@arkaria.postgresql.org; Thu, 15 May 2014 19:31:06 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wl1Mv-0005BV-TN for pgsql-hackers@arkaria.postgresql.org; Thu, 15 May 2014 19:31:05 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wl1Mu-0005BN-Oy for pgsql-hackers@postgreSQL.org; Thu, 15 May 2014 19:31:04 +0000 Received: from smtp-outbound-1.vmware.com ([208.91.2.12]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wl1Mq-0005UM-DY for pgsql-hackers@postgreSQL.org; Thu, 15 May 2014 19:31:04 +0000 Received: from sc9-mailhost2.vmware.com (sc9-mailhost2.vmware.com [10.113.161.72]) by smtp-outbound-1.vmware.com (Postfix) with ESMTP id DE3E92822F; Thu, 15 May 2014 12:30:55 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (zcs-prod-ext-mta-2.vmware.com [10.113.62.224]) by sc9-mailhost2.vmware.com (Postfix) with ESMTP id D519AB15A7; Thu, 15 May 2014 12:30:55 -0700 (PDT) Received: from zcs-prod-ext-mta-2.vmware.com (localhost.localdomain [127.0.0.1]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTP id EC1D3C004D; Thu, 15 May 2014 12:31:01 -0700 (PDT) Received: from [192.168.1.90] (zimbra-prod-ext-proxy-vip.vmware.com [10.113.63.87]) by zcs-prod-ext-mta-2.vmware.com (Postfix) with ESMTPSA; Thu, 15 May 2014 12:31:01 -0700 (PDT) Message-ID: <537515ED.5060106@vmware.com> Date: Thu, 15 May 2014 22:30:53 +0300 From: Heikki Linnakangas Organization: VMware User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Icedove/24.4.0 MIME-Version: 1.0 To: Andres Freund CC: PostgreSQL-development Subject: Re: Logical replication woes References: <5374F1FF.9000902@vmware.com> <5374F44B.1060003@vmware.com> <20140515174657.GI23662@alap3.anarazel.de> In-Reply-To: <20140515174657.GI23662@alap3.anarazel.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -7.6 (-------) 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 On 05/15/2014 08:46 PM, Andres Freund wrote: > On 2014-05-15 20:07:23 +0300, Heikki Linnakangas wrote: >> Ok, so the immediate cause was quick to find: when decoding a >> commit-prepared WAL record, we have to use the XID from the record content >> (patch attached). The XID in the record header is the XID of the transaction >> doing the COMMIT PREPARED, which is always 0 after patch >> bb38fb0d43c8d7ff54072bfd8bd63154e536b384 which causes the assertion. But it >> was always wrong. After fixing, it no longer asserts or gives the above >> "could not map filenode" error. >> >> However, it still doesn't seem right. When I do the above as a regular >> transaction, ie: >> >> begin; insert into foo values (6); alter table foo alter column id type >> text; commit; >> >> pg_recvlogical prints this: >> >> BEGIN 708 >> table public.foo: INSERT: id[text]:'6' >> COMMIT 708 >> >> But if I do it as a prepared transaction: >> >> begin; insert into foo values (7); alter table foo alter column id type >> text; prepare transaction 'foo'; commit prepared 'foo'; > > How very wierd. The reason for this is that > RecordTransactionCommitPrepared() forgets to fill a couple of fields in > xl_xact_commit. Any reason dbId/tsId aren't filled? They aren't strictly > needed because afaics they're only looked at for relcache invalidations > which prepared xacts don't support, but still? Seems like an oversight in commit dd428c79, which added the fields to xl_xact_commit. They are needed. A prepared xact can indeed cause relcache invalidations, and removal of the init file. For example: begin; cluster pg_opclass using pg_opclass_oid_index ; prepare transaction 'foo'; commit prepared 'foo'; > Attached patch fixes things, but I want to add some regression tests > before commit. Looks good to me. - Heikki -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers