Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yr46m-0006Vq-TM for pgsql-bugs@arkaria.postgresql.org; Sat, 09 May 2015 12:43:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yr46m-0001cf-Ae for pgsql-bugs@arkaria.postgresql.org; Sat, 09 May 2015 12:43:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yr46l-0001cY-9L for pgsql-bugs@postgresql.org; Sat, 09 May 2015 12:43:55 +0000 Received: from mail-qk0-x234.google.com ([2607:f8b0:400d:c09::234]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Yr46i-0006h8-7v for pgsql-bugs@postgresql.org; Sat, 09 May 2015 12:43:54 +0000 Received: by qkx62 with SMTP id 62so63686878qkx.0 for ; Sat, 09 May 2015 05:43:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=references:mime-version:in-reply-to:content-type :content-transfer-encoding:message-id:cc:from:subject:date:to; bh=Znjp/1iakd4wEzjgPqLY26yDHbHxTeom2lF8tF+19NY=; b=09kaL+msSGHL/wFdXWvZeut3fkA8Jb5dbe/7yk1lw+UiT1I2qexHnsVxOmh/ZPbzjs 9B5NaujUyPOq2+ZEloml0W83NKosHDTkwcYgFFvcjjCkpYwzyrChKUWDmxDAgclP24ft gEf1bWPL5PJflYZWLoNaxTkSxp5c/X4QmQ4t8m3dRlN9JwYwC/WT6tsg/XURSgh6m8/d ZMsk3pYtKGAiQSYhRnPFt34wj8puue6XBXiQ9dibVYtAO7P8K8vBLqPZD71Yt2KPlQBp NdbQPt1GOdQ1nt39tim63pRGa0Nm5Bzz3qcwL74xACaoikNTlt6jTrXiy19e7Baol6Yz x6Pw== X-Received: by 10.140.92.214 with SMTP id b80mr3126551qge.56.1431175431193; Sat, 09 May 2015 05:43:51 -0700 (PDT) Received: from [192.168.1.7] (pool-108-24-155-230.cmdnnj.fios.verizon.net. [108.24.155.230]) by mx.google.com with ESMTPSA id f33sm5726665qkh.23.2015.05.09.05.43.49 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sat, 09 May 2015 05:43:50 -0700 (PDT) References: <20150507151849.GE2523@alvh.no-ip.org> <20150507180045.GG2523@alvh.no-ip.org> <20150509015528.GQ2523@alvh.no-ip.org> Mime-Version: 1.0 (1.0) In-Reply-To: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Message-Id: <8486B09E-773B-4838-A7E8-8E48433245E1@gmail.com> Cc: Alvaro Herrera , Kevin Grittner , Amit Kapila , Timothy Garnett , PostgreSQL Bugs X-Mailer: iPhone Mail (12B435) From: Robert Haas 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 To: Thomas Munro X-Pg-Spam-Score: -2.0 (--) 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 On May 9, 2015, at 8:00 AM, Thomas Munro wr= ote: >> On Sat, May 9, 2015 at 2:46 PM, Robert Haas wrot= e: >>> On Fri, May 8, 2015 at 9:55 PM, Alvaro Herrera wrote: >>> Thomas Munro wrote: >>>> I think the fix is something like "if nextMXact =3D=3D oldestMultiXact= Id, >>>> then there are no active multixacts, so the offsetStopLimit should be >>>> set to nextOffset - (a segment's worth)". >>>=20 >>> Makes sense. >>=20 >> Here's a patch that attempts to implement this. >=20 > Thanks. I think I have managed to reproduce something like the data > loss race that we were speculating about. >=20 > 0. initdb, autovacuum =3D 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 p= revent step 4 and thereby avoid catastrophe? ...Robert --=20 Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs