Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCfgw-0004Ec-1Q for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Aug 2013 00:57:30 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCfgv-00005s-HV for pgsql-bugs@arkaria.postgresql.org; Fri, 23 Aug 2013 00:57:29 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCfgu-00005l-EK for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 00:57:28 +0000 Received: from tyo201.gate.nec.co.jp ([210.143.35.51]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCfgo-0007xd-Ip for pgsql-bugs@postgresql.org; Fri, 23 Aug 2013 00:57:26 +0000 Received: from mailgate3.nec.co.jp ([10.7.69.195]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r7N0v99C013583; Fri, 23 Aug 2013 09:57:09 +0900 (JST) Received: from mailsv3.nec.co.jp (imss62.nec.co.jp [10.7.69.157]) by mailgate3.nec.co.jp (8.11.7/3.7W-MAILGATE-NEC) with ESMTP id r7N0v8q03278; Fri, 23 Aug 2013 09:57:08 +0900 (JST) Received: from mail01b.kamome.nec.co.jp (mail01b.kamome.nec.co.jp [10.25.43.2]) by mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id r7N0v8xC027865; Fri, 23 Aug 2013 09:57:08 +0900 (JST) Received: from zuizan.jp.nec.com ([10.26.220.9] [10.26.220.9]) by mail03.kamome.nec.co.jp with ESMTP id BT-MMP-1239092; Fri, 23 Aug 2013 09:56:27 +0900 Received: from NES11GG01569 ([10.21.36.180] [10.21.36.180]) by mail.jp.nec.com with ESMTPA id BT-MMP-12320; Fri, 23 Aug 2013 09:56:27 +0900 From: =?utf-8?B?44OA44Oz44Of44Oz44OV44O844Oz?= To: "'Andres Freund'" Cc: , "'Akio Iwaasa'" References: <008301ce9f39$fa67c520$ef374f60$@mxm.nes.nec.co.jp> <20130822133035.GA17006@awork2.anarazel.de> In-Reply-To: <20130822133035.GA17006@awork2.anarazel.de> Subject: Re: After promote, DB can not UPDATE with SAVEPOINT (could not access status of transaction 1409172) Date: Fri, 23 Aug 2013 09:56:30 +0900 Message-ID: <00f401ce9f9b$9abc44e0$d034cea0$@mxm.nes.nec.co.jp> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Outlook 14.0 Thread-Index: AQHegtimi1YIBd3Bth3kInsU/M+TiAJe1rFPmW85NwA= Content-Language: ja X-Pg-Spam-Score: -7.0 (-------) 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 Hi Andres, Thank you for your prompt response. I've confirmed in REL9_1_STABLE and could not reproduce that issue. Also confirm the source and did not find problem with it. Regard, --- Dang Minh Huong NEC Soft,Ltd. http://www.necsoft.com/eng/ > -----Original Message----- > From: Andres Freund [mailto:andres@2ndquadrant.com] > Sent: Thursday, August 22, 2013 10:31 PM > To: =E3=83=80=E3=83=B3=E3=83=9F=E3=83=B3=E3=83=95=E3=83=BC=E3=83=B3 > Cc: pgsql-bugs@postgresql.org; 'Akio Iwaasa' > Subject: Re: [BUGS] After promote, DB can not UPDATE with SAVEPOINT (coul= d not access status of transaction > 1409172) >=20 > Hi, >=20 > On 2013-08-22 22:17:40 +0900, =E3=83=80=E3=83=B3=E3=83=9F=E3=83=B3=E3=83= =95=E3=83=BC=E3=83=B3 wrote: > > I've get found out that issue in my project. > > Update in PRIMARY while pg_basebackup is performing, Can cause the > > STANDBY could not UPDATE after promote. > > > > In Standby Node, when first XID of a page come, pg_subtrans must be > > extended by ExtendSUBTRANS function. > > > > But if that XID created while pg_basebackup (with "-x" option) was > > performing, it did not extend. > > > > Due to that, after basebackup complete, start that DB and do promote > > complete. It failed in SAVEPOINT UPDATE query like follows. > > > > --- > > postgres=3D# BEGIN; > > postgres=3D# SAVEPOINT testsavepoint; > > postgres=3D# UPDATE test_tbl SET name =3D 'test'; > > ERROR: could not access status of transaction 1409172 > > DETAIL: Could not read from file "pg_subtrans/0015" at offset 131072: = Success. > > --- > > > > I've also confirm source and realize that, > > > > When StartupXLOG call RecordKnownAssignedTransactionIds (in the "main > > redo apply loop"), the "standbyState" still was STANDBY_INITIALIZED, > > so it is returned without goto ExtendSUBTRANS (to check and extend > > space for pg_subtrans). > > > > Therefor, after STANDBY promote, when UPDATE query made by SAVEPOINT > > is executed, the process as follow is performed and get the above > > ERROR in SimpleLruReadPage function. > > > > AssignTransactionId =3D> SubTransSetParent =3D> SubTransSetParent =3D> > > SimpleLruReadPage > > > > I think that ExtendSUBTRANS must be called even if "standbyState" > > in STANDBY_INITIALIZED in order to avoid the case above. > > > > I also attach a patch. Could anyone confirm for me. >=20 > Nice diagnosis and thanks for the patch! >=20 > I think the the issue has already been fixed while investigating a simila= r issue, could you verify that the > current git version works for you? >=20 > c.f. commit 99ee15b315c187045a95db7b27fd9d866aea93e0 >=20 > Greetings, >=20 > Andres Freund >=20 > -- > Andres Freund http://www.2ndQuadrant.com/ > PostgreSQL Development, 24x7 Support, Training & Services --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs