pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alvaro Herrera <alvherre@2ndquadrant.com>
To: Kevin Grittner <kgrittn@ymail.com>
Cc: Robert Haas <robertmhaas@gmail.com>
Cc: thomas.munro@enterprisedb.com <thomas.munro@enterprisedb.com>
Cc: tgarnett@panjiva.com <tgarnett@panjiva.com>
Cc: pgsql-bugs@postgresql.org <pgsql-bugs@postgresql.org>
Subject: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)
Date: Mon, 27 Apr 2015 12:24:41 -0300
Message-ID: <20150427152441.GV4369@alvh.no-ip.org> (raw)
In-Reply-To: <1834878822.5207111.1430146622134.JavaMail.yahoo@mail.yahoo.com>
References: <CA+TgmoZVaM+-Z7Q_DGJ+XkvFRw2-91LR78ir27m1K6ZFRpa49Q@mail.gmail.com>
	<1834878822.5207111.1430146622134.JavaMail.yahoo@mail.yahoo.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

Kevin Grittner wrote:
> Robert Haas <robertmhaas@gmail.com> wrote:
> > On Fri, Apr 24, 2015 at 5:34 PM, Kevin Grittner <kgrittn@ymail.com> wrote:
> >> I think I see why I was seeing this and nobody else was
> >
> > Thomas said he reproduced it.  No?
> 
> I should have been more clear about what I meant by "this".  Thomas
> said he reproduced the immediate errors with Álvaro's patch, but if
> he said anything about files in the members subdirectory not going
> away with VACUUM followed by CHECKPOINT, regardless of
> configuration, I missed it.  It turns out that these steps only
> "prime the pump" for the files to be deleted on subsequent access
> to the members SLRU.  That doesn't contribute to database
> corruption, but it sure can be confusing for someone trying to
> clean things up.

The whole matter of truncating multixact is a longish trip.  It starts
when autovacuum completes a round or VACUUM finishes processing a table;
these things call vac_update_datfrozenxid.  That routine scans pg_class
and sees if datfrozenxid or datminmxid can be advanced from their
current points; only if any of these can, vac_truncate_clog is called.
That routine calls SetMultiXactIdLimit(), which determines a new
MultiXactState->oldestMultiXactId (saved in shared memory).  The
involvement of vacuum stops here; following steps happen at checkpoint.

At checkpoint, oldestMultiXactId is saved to pg_control as part of a
checkpoint (MultiXactGetCheckptMulti); the checkpointed value is passed
back to multixact by MultiXactSetSafeTruncate, which saves it in shmem
as lastCheckpointedOldest.  The same checkpoint later calls
TruncateMultiXact which can remove files.

Note that if vac_update_datfrozenxid finds that the pg_database values
cannot be changed (during the vacuum phase), the multixact truncation
point is not advanced and checkpoint has nothing to do.  But note that
the clog counter advancing enough will also trigger multixact
truncation.

-- 
Á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: <20150427152441.GV4369@alvh.no-ip.org>
Permalink:  ../20150427152441.GV4369@alvh.no-ip.org/
Also on:    postgresql.org/message-id/20150427152441.GV4369@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, kgrittn@ymail.com, robertmhaas@gmail.com, thomas.munro@enterprisedb.com, tgarnett@panjiva.com
  Subject: Re: BUG #12990: Missing pg_multixact/members files (appears to have wrapped, then truncated)
  In-Reply-To: <20150427152441.GV4369@alvh.no-ip.org>
  References: <CA+TgmoZVaM+-Z7Q_DGJ+XkvFRw2-91LR78ir27m1K6ZFRpa49Q@mail.gmail.com> <1834878822.5207111.1430146622134.JavaMail.yahoo@mail.yahoo.com> <20150427152441.GV4369@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