Re: BUG #17245: Index corruption involving deduplicated entries

From: Andres Freund <andres(at)anarazel(dot)de>
To: Kamigishi Rei <iijima(dot)yun(at)koumakan(dot)jp>
Cc: Andrew Gierth <andrew(at)tao11(dot)riddles(dot)org(dot)uk>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>, Peter Geoghegan <pg(at)bowt(dot)ie>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Subject: Re: BUG #17245: Index corruption involving deduplicated entries
Date: 2021-10-29 20:59:09
Message-ID: 20211029205909.ycbqxtz75srf75lu@alap3.anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Hi,

On 2021-10-29 13:49:45 -0700, Andres Freund wrote:
> > rmgr: Heap        len (rec/tot):     54/    54, tx:    2014291, lsn:
> > 2/8DEC0460, prev 2/8DEC0420, desc: LOCK off 53: xid 2014291: flags 0x00
> > LOCK_ONLY EXCL_LOCK , blkref #0: rel 1663/19243/19560 blk 540
> > rmgr: Heap        len (rec/tot):     82/    82, tx:    2014291, lsn:
> > 2/8DEC0498, prev 2/8DEC0460, desc: HOT_UPDATE off 53 xmax 2014291 flags 0x60
> > ; new off 41 xmax 2014291, blkref #0: rel 1663/19243/19560 blk 540
>
> HOT of 540,53, now at 540,41.
>
> Here I am confused. 540,41 was presumably marked dead in 2/8DEC0420, but not
> marked unused? So this shouldn't be possible.
>
> What am I missing?

Oh. Likely the issue is that heap2_desc() doesn't print the number of
redirects.

I'm considering writing a patch that
1) displays the number of tuples marked unused in HEAP2_PRUNE. This might only
be possible if no FPW was used
2) if a HEAP2_PRUNE or HEAP2_VACUUM isn't an FPW, display the offsets

For 15 I think it might be worth to explicitly store the number of offets
marked unused, rather than inferring that. It's hard to believe that the 16
bit for that would be a relevant overhead, and having that more readily
available seems like a significant improvement in debuggability.

Greetings,

Andres Freund

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David M. Calascibetta 2021-10-29 21:06:02 RE: FW: BUG #17258: Unexpected results in CHAR(1) data type
Previous Message Andres Freund 2021-10-29 20:49:45 Re: BUG #17245: Index corruption involving deduplicated entries