Re: B-tree crash recovery error in 8.3 beta 2

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Koichi Suzuki <suzuki(dot)koichi(at)oss(dot)ntt(dot)co(dot)jp>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: B-tree crash recovery error in 8.3 beta 2
Date: 2007-11-16 11:08:49
Message-ID: 473D7A41.5040507@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Koichi Suzuki wrote:
> I've found that B-tree crash recovery in 8.3 beta2 could make some
> tuples invisible through B-tree. They're visible if we read using but
> Seq-Scan. This happens in 8.3 beta2, but not in 8.2.4. Here's how it
> happens.
>
> 1. Create b-tree for a text type column.
> 2. Make B-tree three-story, that is, root-intermediate-leaf. Insert
> tuples sufficient to construct such B-tree.
> 3. No checkpoint should occur during 2.
> 4. Kill postmaster.
> 5. Restart postmaster. Crash recovery will be done.
> 6. Tuples with column values less than HIKEY becomes invisible through
> Idx-scan, still visible through Seq-scan.
>
> From the dump of B-tree, it seems that HIKEY value is cleared (only
> tuple header is left). No problem was found in the case of integer or
> numeric type columns.
>
> Attached is the shell script, postgresql.conf (almost the default one)
> to reproduce the problem, and the log of the problem reproduction.

Thanks for the excellent reproducer script!

There seems to be a bug in the B-tree split WAL reduction patch from
Februrary. On split, we copy the HIKEY of the left page from the
leftmost item on the right page, but that doesn't work because the
leftmost key is not stored on intermediate levels.

Patch attached that stores the high key explicitly in the WAL record on
intermediate levels.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

Attachment Content-Type Size
btree-split-fix-1.patch text/x-diff 5.2 KB

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Lance J. Andersen 2007-11-16 15:46:40 Re: BUG #3751: Conversion error using PreparedStatement.setObject()
Previous Message Zdenek Kotala 2007-11-16 09:52:54 Re: BUG #3752: query yields "could not find block containing chunk", then server crashes