pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Kevin Grittner <kgrittn@ymail.com>
Cc: Amit Kapila <amit.kapila16@gmail.com>
Cc: Timothy Garnett <tgarnett@panjiva.com>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)
Date: Thu, 7 May 2015 15:00:45 -0300
Message-ID: <20150507180045.GG2523@alvh.no-ip.org> (raw)
In-Reply-To: <CA+TgmobbaQpE6sNqT30+rz4UMH5aPraq20gko5xd2ZGajz1-Jg@mail.gmail.com>
References: <CA+TgmoaR67gP-QBOhfWRod_E-7YKudSEo84-Z=_0PycnetgBuw@mail.gmail.com>
	<20150506143418.GT2523@alvh.no-ip.org>
	<CA+TgmoZH5yBwa98oeuipxUN0m_U2+Yd9kdRY+CcZtT9Q=R8MZA@mail.gmail.com>
	<CAEepm=10MwoFjdDgTeGUh6QO0QG89OE3c7tkbenRYLXF2t0OkA@mail.gmail.com>
	<26622F69-38AB-479C-9155-8CAE65DBF9B6@gmail.com>
	<CAEepm=3OPzjcqdM3vm4dM0VFYW9RjMcW8u+7LFKMWArQ7=mS=A@mail.gmail.com>
	<CA+TgmoYtFwG2n61WAiSKcgEqFSXWkUr6oSyzeGD_KtUn7CvNKQ@mail.gmail.com>
	<20150507151849.GE2523@alvh.no-ip.org>
	<CA+TgmoZ1POPQNfYFL8Wv9_tT=MMmSZf5GEAqj4ieWHk+H5iRMA@mail.gmail.com>
	<CA+TgmobbaQpE6sNqT30+rz4UMH5aPraq20gko5xd2ZGajz1-Jg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Robert Haas wrote:

> It seems to me that the most obvious places where
> DetermineSafeOldestOffset() should be called are (1) at startup or
> after recovery, to initialize the value; and (2) each time we truncate
> the SLRU, to update the value.  Other than that, this doesn't change.
> The startup calls are there, in apparently reasonable places, but it's
> not obvious to me how this gets called in the TruncateMultiXact path.
> Instead it seems to get set via the SetMultiXactIdLimit path.  Maybe
> that's OK, but it would seem to imply that we're OK with overwriting
> old members information if that information was slated for truncation
> at the next checkpoint anyway, which seems scary.

I considered this question in the previous commit: is it okay to
overwrite a file that is no longer used (per the limits set by vacuum)
but not yet removed (by checkpoint)?  It seems to me that there is no
data-loss issue with doing that -- which is why the advance-oldest code
is called during vacuum and not during checkpoint.

> Wouldn't it be better to only advance the threshold once the
> checkpoint completes and the truncation is done?

*shrug*


There's also a question about this function's "else" branch:

void
MultiXactAdvanceOldest(MultiXactId oldestMulti, Oid oldestMultiDB)
{
    if (MultiXactIdPrecedes(MultiXactState->oldestMultiXactId, oldestMulti))
        SetMultiXactIdLimit(oldestMulti, oldestMultiDB);
    else
        DetermineSafeOldestOffset(oldestMulti);
}

The reason the "else" is there is that I chickened out about not calling
DetermineSafeOldestOffset() (which SetMultiXactIdLimit calls) when the
oldestMulti does not advance; what if in the previous run we failed to
get to this point for whatever reason?  The calls to SetMultiXactIdLimit
are seldom enough that it seemed better to be protected against previous
runs not finishing.  Then again, I might be worrying over nothing and
this is just dead code.

Also, if we have extra calls in other places after Thomas' patch,
perhaps this one is not necessary.

-- 
Álvaro Herrera                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, 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 (113+ messages)  latest in thread

Message-ID: <20150507180045.GG2523@alvh.no-ip.org>
Permalink:  ../20150507180045.GG2523@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20150507180045.GG2523@alvh.no-ip.org

 · 

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: alvherre@2ndquadrant.com, robertmhaas@gmail.com, thomas.munro@enterprisedb.com, kgrittn@ymail.com, amit.kapila16@gmail.com, tgarnett@panjiva.com
  Subject: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)
  In-Reply-To: <20150507180045.GG2523@alvh.no-ip.org>
  References: <CA+TgmoaR67gP-QBOhfWRod_E-7YKudSEo84-Z=_0PycnetgBuw@mail.gmail.com> <20150506143418.GT2523@alvh.no-ip.org> <CA+TgmoZH5yBwa98oeuipxUN0m_U2+Yd9kdRY+CcZtT9Q=R8MZA@mail.gmail.com> <CAEepm=10MwoFjdDgTeGUh6QO0QG89OE3c7tkbenRYLXF2t0OkA@mail.gmail.com> <26622F69-38AB-479C-9155-8CAE65DBF9B6@gmail.com> <CAEepm=3OPzjcqdM3vm4dM0VFYW9RjMcW8u+7LFKMWArQ7=mS=A@mail.gmail.com> <CA+TgmoYtFwG2n61WAiSKcgEqFSXWkUr6oSyzeGD_KtUn7CvNKQ@mail.gmail.com> <20150507151849.GE2523@alvh.no-ip.org> <CA+TgmoZ1POPQNfYFL8Wv9_tT=MMmSZf5GEAqj4ieWHk+H5iRMA@mail.gmail.com> <CA+TgmobbaQpE6sNqT30+rz4UMH5aPraq20gko5xd2ZGajz1-Jg@mail.gmail.com> <20150507180045.GG2523@alvh.no-ip.org>

* 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