pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Robert Haas <robertmhaas@gmail.com>
To: Thomas Munro <thomas.munro@enterprisedb.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.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: Sat, 9 May 2015 08:43:49 -0400
Message-ID: <8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com> (raw)
In-Reply-To: <CAEepm=3C32VPJLOo45y0c3-3KWXNV2xM4jaPTSVjCRD2VG0Qgg@mail.gmail.com>
References: <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>
	<CAEepm=12OoYdLSCXAN3dT2eCFpVfUcc9WRZ59ROrFDGhevtW7g@mail.gmail.com>
	<D8A99261-9E17-436B-B08C-BDCDBB07239D@gmail.com>
	<CA+TgmoZiHwybETx8NZzPtoSjprg2Kcr-NaWGajkzcLcbVJ1pKQ@mail.gmail.com>
	<CAEepm=1XGJVijxqG2EE=3Tb2bbrQRTvnXA6vZN1FkOZNtH=Lqw@mail.gmail.com>
	<20150509015528.GQ2523@alvh.no-ip.org>
	<CA+Tgmob8BR-D6Zhjse3j8GA2-Sv=NhV9pZfj72hm0gDErZ_-mA@mail.gmail.com>
	<CAEepm=3C32VPJLOo45y0c3-3KWXNV2xM4jaPTSVjCRD2VG0Qgg@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On May 9, 2015, at 8:00 AM, Thomas Munro <thomas.munro@enterprisedb.com> wrote:
>> On Sat, May 9, 2015 at 2:46 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>>> On Fri, May 8, 2015 at 9:55 PM, Alvaro Herrera <alvherre@2ndquadrant.com> wrote:
>>> Thomas Munro wrote:
>>>> I think the fix is something like "if nextMXact == oldestMultiXactId,
>>>> then there are no active multixacts, so the offsetStopLimit should be
>>>> set to nextOffset - (a segment's worth)".
>>> 
>>> Makes sense.
>> 
>> Here's a patch that attempts to implement this.
> 
> Thanks.  I think I have managed to reproduce something like the data
> loss race that we were speculating about.
> 
> 0.  initdb, autovacuum = off, set up explode_mxact_members.c as
> described elsewhere in the thread.
> 1.  Fill up the members SLRU completely (ie reach state where you can
> no longer create a new multixact of any size).  pg_multixact/members
> contains 82040 files and the last one is named 14077.
> 2.  Issue CHECKPOINT, but use a debugger to stop inside
> TruncateMultiXact after it has read
> MultiXactState->lastCheckpointedOldest and released the lock, but
> before it calls SlruScanDirectory to delete files...
> 3.  Run VACUUM FREEZE in all databases (including template0).  datminmxid moves.
> 4.  Create lots of new multixacts.  pg_multixact/members now contains
> 82041 files and the last one is named 14078 (ie one extra segment,
> with the highest possible segment number, which couldn't be created
> before vacuuming because of the one segment gap enforced by
> DetermineSafeOldestOffset).  Segments 0000-0016 have new modified
> times.
> 5.  ... allow the checkpoint started in step 2 to continue.  It
> deletes segments, keeping only 0000-0016.  The segment 14078 which
> contained active member data has been incorrectly deleted.

OK. So the next question is: if you then apply the other patch, does that prevent step 4 and thereby avoid catastrophe?

...Robert

-- 
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: <8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com>
Permalink:  ../8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com/
Also on:    postgresql.org/message-id/8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com

 · 

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: robertmhaas@gmail.com, thomas.munro@enterprisedb.com, alvherre@2ndquadrant.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: <8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com>
  References: <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> <CAEepm=12OoYdLSCXAN3dT2eCFpVfUcc9WRZ59ROrFDGhevtW7g@mail.gmail.com> <D8A99261-9E17-436B-B08C-BDCDBB07239D@gmail.com> <CA+TgmoZiHwybETx8NZzPtoSjprg2Kcr-NaWGajkzcLcbVJ1pKQ@mail.gmail.com> <CAEepm=1XGJVijxqG2EE=3Tb2bbrQRTvnXA6vZN1FkOZNtH=Lqw@mail.gmail.com> <20150509015528.GQ2523@alvh.no-ip.org> <CA+Tgmob8BR-D6Zhjse3j8GA2-Sv=NhV9pZfj72hm0gDErZ_-mA@mail.gmail.com> <CAEepm=3C32VPJLOo45y0c3-3KWXNV2xM4jaPTSVjCRD2VG0Qgg@mail.gmail.com> <8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com>

* 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