Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCUmO-0005eS-QE for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Aug 2013 13:18:24 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VCUmO-0008VF-6X for pgsql-bugs@arkaria.postgresql.org; Thu, 22 Aug 2013 13:18:24 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCUmN-0008V9-BH for pgsql-bugs@postgresql.org; Thu, 22 Aug 2013 13:18:23 +0000 Received: from tyo201.gate.nec.co.jp ([210.143.35.51]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VCUmF-0002ZF-Ll for pgsql-bugs@postgresql.org; Thu, 22 Aug 2013 13:18:22 +0000 Received: from mailgate3.nec.co.jp ([10.7.69.192]) by tyo201.gate.nec.co.jp (8.13.8/8.13.4) with ESMTP id r7MDIDDs006485 for ; Thu, 22 Aug 2013 22:18:13 +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 r7MDICn27146 for ; Thu, 22 Aug 2013 22:18:12 +0900 (JST) Received: from mail02.kamome.nec.co.jp (mail02.kamome.nec.co.jp [10.25.43.5]) by mailsv3.nec.co.jp (8.13.8/8.13.4) with ESMTP id r7MDIC15029116 for ; Thu, 22 Aug 2013 22:18:12 +0900 (JST) Received: from zuizan.jp.nec.com ([10.26.220.9] [10.26.220.9]) by mail01b.kamome.nec.co.jp with ESMTP id BT-MMP-1230358; Thu, 22 Aug 2013 22:17:42 +0900 Received: from NES11GG01569 ([10.21.36.180] [10.21.36.180]) by mail.jp.nec.com with ESMTPA id BT-MMP-63823; Thu, 22 Aug 2013 22:17:42 +0900 From: =?iso-2022-jp?B?GyRCJUAlcyVfJXMlVSE8JXMbKEI=?= To: Cc: "'Akio Iwaasa'" Subject: After promote, DB can not UPDATE with SAVEPOINT (could not access status of transaction 1409172) Date: Thu, 22 Aug 2013 22:17:40 +0900 Message-ID: <008301ce9f39$fa67c520$ef374f60$@mxm.nes.nec.co.jp> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0084_01CE9F85.6A4F6D20" X-Mailer: Microsoft Outlook 14.0 Thread-Index: Ac6fOBOYoBuBmrUjSfCOX93ZMq62DA== Content-Language: ja X-Pg-Spam-Score: -4.3 (----) 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 This is a multipart message in MIME format. ------=_NextPart_000_0084_01CE9F85.6A4F6D20 Content-Type: text/plain; charset="iso-2022-jp" Content-Transfer-Encoding: 7bit Hi all, 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=# BEGIN; postgres=# SAVEPOINT testsavepoint; postgres=# UPDATE test_tbl SET name = '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 => SubTransSetParent => SubTransSetParent => 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. Regard, --- Dang Minh Huong NEC Soft,Ltd. http://www.necsoft.com/eng/ ------=_NextPart_000_0084_01CE9F85.6A4F6D20 Content-Type: application/octet-stream; name="subtrans.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="subtrans.patch" *** src/backend/storage/ipc/procarray.c.org 2013-04-02 03:23:05.000000000 += 0900=0A= --- src/backend/storage/ipc/procarray.c.new 2013-08-22 19:59:35.000000000 += 0900=0A= ***************=0A= *** 2418,2423 ****=0A= --- 2418,2433 ----=0A= xid, latestObservedXid);=0A= =20=20=0A= /*=0A= + * Extend clog and subtrans like we do in GetNewTransactionId().=0A= + * It is nesscessary even if when standbyState is STANDBY_INITIALIZED.= =0A= + */=0A= + if (standbyState =3D=3D STANDBY_INITIALIZED)=0A= + {=0A= + ExtendCLOG(xid);=0A= + ExtendSUBTRANS(xid);=0A= + }=0A= +=20=09=0A= + /*=0A= * If the KnownAssignedXids machinery isn't up yet, do nothing.=0A= */=0A= if (standbyState <=3D STANDBY_INITIALIZED)=0A= ------=_NextPart_000_0084_01CE9F85.6A4F6D20 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs ------=_NextPart_000_0084_01CE9F85.6A4F6D20--