Skip site navigation (1) Skip section navigation (2)

Re: TRAP: FailedAssertion("!((itemid)->lp_flags & 0x01)", File: "nbtsearch.c", Line: 89)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Jim C(dot) Nasby" <jnasby(at)pervasive(dot)com>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: TRAP: FailedAssertion("!((itemid)->lp_flags & 0x01)", File: "nbtsearch.c", Line: 89)
Date: 2005-10-28 03:53:01
Message-ID: 26369.1130471581@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"Jim C. Nasby" <jnasby(at)pervasive(dot)com> writes:
> On Wed, Oct 26, 2005 at 09:29:23PM -0400, Tom Lane wrote:
>> Could you send me the whole file (off-list)?

> Ok, will send URL as soon as I have it from client.

Well, the answer is that there's nothing wrong with that index except
that four consecutive pages near the end (32K total) have been zeroed
out :-(

In the situation where _bt_search descends into one of these pages,
we'd have the following behavior:

* P_RIGHTMOST() appears true because btpo_next is zero, therefore
_bt_moveright does nothing.

* P_ISLEAF() appears false because the flags word is zero, so we
don't fall out of the loop.

* _bt_binsrch finds high < low and returns low (ie, 1) rather than complaining.

* If Asserts are on then the internal ItemIdIsUsed assert in PageGetItem
triggers, resulting in the behavior mentioned in $subject.

* If not, then we stupidly fetch a zero block number out of the
nonexistent item, and iterate to page zero, ie, the metapage.
The above observations still hold true for the metapage, so
it's an infinite loop --- or would be except that we're building
a stack entry each time around the loop, and so we gradually
exhaust memory.  This matches the other behavior Jim saw.

Bottom line is that index searches probably ought to have some
non-Assert defenses against zeroed-out pages.  Obviously we can't
expect to catch every flavor of data corruption, but this particular
one has been seen before...

BTW, Jim, any thoughts about how the index got corrupted?  Have you
had any crashes on that machine lately?

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Philip YarraDate: 2005-10-28 03:54:27
Subject: Re: pl/pgsql breakage in 8.1b4?
Previous:From: Stephan SzaboDate: 2005-10-28 03:37:49
Subject: Re: pl/pgsql breakage in 8.1b4?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group