From: Heikki Linnakangas <hlinnakangas@vmware.com>
To: Greg Stark <stark@mit.edu>
To: Andres Freund <andres@2ndquadrant.com>
Cc: Maciek Sakrejda <m.sakrejda@gmail.com>
Cc: PostgreSQL Bugs <pgsql-bugs@postgresql.org>
Subject: Re: BUG #10432: failed to re-find parent key in index
Date: Wed, 04 Jun 2014 15:06:19 +0300
Message-ID: <538F0BBB.5000308@vmware.com> (raw)
In-Reply-To: <CAM-w4HM3wLZU_qd6fU7XhEiPX9DO-R_FBszfQqE9GhrNy-kfYw@mail.gmail.com>
References: <CAOtHd0A=ZJDbh2FU0jauLjN-_W7_BR79F+t0y99J=xXf8Jao9A@mail.gmail.com>
<20140529160835.GO27914@awork2.anarazel.de>
<CAOtHd0AQShrajYehGS4qpHTJPxZ3uKwj3tqQxKEH3TKCyfSc5g@mail.gmail.com>
<20140529171934.GP27914@awork2.anarazel.de>
<CAOtHd0B8n_K13ajd_V7zewDG5m5Q+nfQGBh0Ht8486-ttnyKtw@mail.gmail.com>
<CAM-w4HP34ppweGTCwjBZnWhQ0CmU-Lxna62vjKU8QRTWLOBuHw@mail.gmail.com>
<538839CF.5080007@vmware.com>
<CAM-w4HP=Fn2pV-GCc-C_b=gFXFnF+v-W-o+QV34YK63MSDNVfA@mail.gmail.com>
<20140602174007.GF24145@awork2.anarazel.de>
<CAM-w4HM3XEuAOSKeGLhBa0tV5Zwdv7Sx4Uo849a2-ivJZG8szA@mail.gmail.com>
<20140603094337.GJ24145@awork2.anarazel.de>
<CAM-w4HM3wLZU_qd6fU7XhEiPX9DO-R_FBszfQqE9GhrNy-kfYw@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
On 06/04/2014 02:14 PM, Greg Stark wrote:
> Ok, I made some progress. It turns out this was a pre-existing problem
> in the master. They've been getting "failed to re-find parent" errors
> for weeks. Far longer than I have any WAL or backups for.
Bummer. You don't have logs reaching back to when the first error
happened either, I presume.
The most likely cause for originally failing to insert a downlink is
running out of disk space when trying to split the parent page. (Even
that's pretty unlikely, though.)
> What I did find that was interesting is that this error basically made
> the backups worthless. I could build a hot standby and connect and
> query it. But as soon as recovery finished it would try to clean up
> the incomplete split and fail. Because it had noticed the incomplete
> split it had skipped every restartpoint and the next time I tried to
> start it it insisted on restarting recovery from the beginning. If we
> had been lucky enough not to do any page splits in the broken index
> while the backup was being taken all would have been fine. But that
> doesn't seem to have happened so all the backups were unrecoverable.
It's only *incomplete* splits that happen while the backup is taken that
matter. i.e. a page is split but inserting the downlink to the parent
fails for some reason. If a page is split and the downlink is inserted
successfully, that's OK.
> So a few thoughts on how to improve things:
>
> 1) Failed to re-find parent should perhaps not be FATAL to recovery.
> In fact any index replay error would really be nice not to have to
> crash on. All crashing does is prevent the user from being able to
> bring up their database and REINDEX the btree. This may be another use
> case for the machinery that would protect against corrupt hash indexes
> or user-defined indexes -- if we could mark the index invalid and
> proceed (perhaps ignoring subsequent records for it) that would be
> great.
Yeah, that would be nice as an option.
> 2) When we see an abort record we could check for any cleanup actions
> triggered by that transaction and run them right away. I think the
> checkpoints (and maybe hot standby snapshots or vacuum cleanup
> records?) also include information about the oldest xid running, they
> would also let us prune the cleanup actions sooner. That would at
> least find the error sooner. In conjunction with (1) it would also
> mean subsequent restartpoints would be effective instead of
> suppressing restartpoints right to the end of recovery.
You can't do any cleanup actions until you've recovered all the WAL. A
cleanup action means inserting a tuple to the parent page, and you can't
do that in the middle of recovery.
But we could detect the case and give a warning.
> 3) The lack of logs around an error during recovery makes it hard to
> decipher what's going on. It would be nice to see "Beginning Xlog
> cleanup (1 incomplete splits to replay)" and when it crashed "Last
> safe point to restart recovery is 324/ABCDEF". As it was it was a
> pretty big mystery why the database crashed, the logs made it appear
> as if it had started up fine. And it was unclear why restarting it
> caused it to replay from the beginning, I thought maybe something was
> wrong with our scripts
Yeah. All of this is gone in 9.4 anyway, but if you can come up with
something non-invasive that can be back-patched...
- Heikki
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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: hlinnakangas@vmware.com, stark@mit.edu, andres@2ndquadrant.com, m.sakrejda@gmail.com
Subject: Re: BUG #10432: failed to re-find parent key in index
In-Reply-To: <538F0BBB.5000308@vmware.com>
References: <CAOtHd0A=ZJDbh2FU0jauLjN-_W7_BR79F+t0y99J=xXf8Jao9A@mail.gmail.com> <20140529160835.GO27914@awork2.anarazel.de> <CAOtHd0AQShrajYehGS4qpHTJPxZ3uKwj3tqQxKEH3TKCyfSc5g@mail.gmail.com> <20140529171934.GP27914@awork2.anarazel.de> <CAOtHd0B8n_K13ajd_V7zewDG5m5Q+nfQGBh0Ht8486-ttnyKtw@mail.gmail.com> <CAM-w4HP34ppweGTCwjBZnWhQ0CmU-Lxna62vjKU8QRTWLOBuHw@mail.gmail.com> <538839CF.5080007@vmware.com> <CAM-w4HP=Fn2pV-GCc-C_b=gFXFnF+v-W-o+QV34YK63MSDNVfA@mail.gmail.com> <20140602174007.GF24145@awork2.anarazel.de> <CAM-w4HM3XEuAOSKeGLhBa0tV5Zwdv7Sx4Uo849a2-ivJZG8szA@mail.gmail.com> <20140603094337.GJ24145@awork2.anarazel.de> <CAM-w4HM3wLZU_qd6fU7XhEiPX9DO-R_FBszfQqE9GhrNy-kfYw@mail.gmail.com> <538F0BBB.5000308@vmware.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