pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@2ndquadrant.com>
To: ダンミンフーン <dangminh-huong@mxm.nes.nec.co.jp>
Cc: pgsql-bugs@postgresql.org
Cc: Akio Iwaasa <iwaasa@mxs.nes.nec.co.jp>
Subject: Re: After promote, DB can not UPDATE with SAVEPOINT (could not access status of transaction 1409172)
Date: Thu, 22 Aug 2013 15:30:35 +0200
Message-ID: <20130822133035.GA17006@awork2.anarazel.de> (raw)
In-Reply-To: <008301ce9f39$fa67c520$ef374f60$@mxm.nes.nec.co.jp>
References: <008301ce9f39$fa67c520$ef374f60$@mxm.nes.nec.co.jp>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Hi,

On 2013-08-22 22:17:40 +0900, ダンミンフーン 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=# 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.

Nice diagnosis and thanks for the patch!

I think the the issue has already been fixed while investigating a
similar issue, could you verify that the current git version works for
you?

c.f. commit 99ee15b315c187045a95db7b27fd9d866aea93e0

Greetings,

Andres Freund

-- 
 Andres Freund	                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (3+ messages)  latest in thread

Message-ID: <20130822133035.GA17006@awork2.anarazel.de>
Permalink:  ../20130822133035.GA17006@awork2.anarazel.de/
Also on:    postgresql.org/message-id/20130822133035.GA17006@awork2.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@2ndquadrant.com, dangminh-huong@mxm.nes.nec.co.jp, iwaasa@mxs.nes.nec.co.jp
  Subject: Re: After promote, DB can not UPDATE with SAVEPOINT (could not access status of transaction 1409172)
  In-Reply-To: <20130822133035.GA17006@awork2.anarazel.de>
  References: <008301ce9f39$fa67c520$ef374f60$@mxm.nes.nec.co.jp> <20130822133035.GA17006@awork2.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox