Re: BUG #17245: Index corruption involving deduplicated entries

From: Kamigishi Rei <iijima(dot)yun(at)koumakan(dot)jp>
To: Andres Freund <andres(at)anarazel(dot)de>
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 19:52:39
Message-ID: 399affa1-c9c5-9b3e-c14f-b24ecb86b303@koumakan.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On 29.10.2021 21:36, Kamigishi Rei wrote:
> btree index "azurlane_wiki.mediawiki.page_main_title":
>     ERROR:  item order invariant violated for index "page_main_title"
>     DETAIL:  Lower index tid=(17,157) (points to heap tid=(540,5))
> higher index tid=(17,158) (points to heap tid=(540,5)) page
> lsn=2/A019DD78.

I forgot to include WAL archive grepped for the "page" table's heap page
540. Note that 540,5 is mentioned below just before VACUUM. `SELECT h.*
FROM heap_page_items(get_raw_page('page',540)) h;` returns lp_flags=3
for lp=5 for the snapshot (though I am not sure if lp=5 here is the same
5 as in the tid=(540,5) tuple).

00000001000000020000008D:
rmgr: Heap        len (rec/tot):     59/  7939, tx:    2013796, lsn:
2/8DA7C498, prev 2/8DA7C470, desc: LOCK off 5: xid 2013796: flags 0x00
LOCK_ONLY EXCL_LOCK KEYS_UPDATED , blkref #0: rel 1663/19243/19560 blk
540 FPW
rmgr: Heap        len (rec/tot):     98/    98, tx:    2013796, lsn:
2/8DAAA0A0, prev 2/8DAA8548, desc: UPDATE off 5 xmax 2013796 flags 0x61
KEYS_UPDATED ; new off 22 xmax 2013796, blkref #0: rel 1663/19243/19560
blk 540
rmgr: Heap2       len (rec/tot):     56/    56, tx:          0, lsn:
2/8DABF558, prev 2/8DABF528, desc: PRUNE latestRemovedXid 2013796
nredirected 0 ndead 1, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     54/    54, tx:    2013798, lsn:
2/8DABF590, prev 2/8DABF558, desc: LOCK off 22: xid 2013798: flags 0x00
LOCK_ONLY EXCL_LOCK , blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     83/    83, tx:    2013798, lsn:
2/8DABF5C8, prev 2/8DABF590, desc: HOT_UPDATE off 22 xmax 2013798 flags
0x60 ; new off 41 xmax 2013798, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/8DACCBB0, prev 2/8DACCB88, desc: PRUNE latestRemovedXid 2013798
nredirected 1 ndead 0, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     59/  7939, tx:    2014289, lsn:
2/8DE8A460, prev 2/8DE8A438, desc: LOCK off 41: xid 2014289: flags 0x00
LOCK_ONLY EXCL_LOCK KEYS_UPDATED , blkref #0: rel 1663/19243/19560 blk
540 FPW
rmgr: Heap        len (rec/tot):     99/    99, tx:    2014289, lsn:
2/8DEB5250, prev 2/8DEB36D8, desc: UPDATE off 41 xmax 2014289 flags 0x60
KEYS_UPDATED ; new off 53 xmax 2014289, blkref #0: rel 1663/19243/19560
blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/8DEC0420, prev 2/8DEC03F0, desc: PRUNE latestRemovedXid 2014289
nredirected 0 ndead 1, blkref #0: rel 1663/19243/19560 blk 540
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
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/8DED6A10, prev 2/8DED69E8, desc: PRUNE latestRemovedXid 2014291
nredirected 1 ndead 0, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     59/  7939, tx:    2014784, lsn:
2/8DFB15D0, prev 2/8DFB1598, desc: LOCK off 41: xid 2014784: flags 0x00
LOCK_ONLY EXCL_LOCK KEYS_UPDATED , blkref #0: rel 1663/19243/19560 blk
540 FPW
rmgr: Heap        len (rec/tot):    100/   100, tx:    2014784, lsn:
2/8DFDAD20, prev 2/8DFD9180, desc: UPDATE off 41 xmax 2014784 flags 0x60
KEYS_UPDATED ; new off 57 xmax 2014784, blkref #0: rel 1663/19243/19560
blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/8DFE5F90, prev 2/8DFE5F60, desc: PRUNE latestRemovedXid 2014784
nredirected 0 ndead 1, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     54/    54, tx:    2014786, lsn:
2/8DFE5FD0, prev 2/8DFE5F90, desc: LOCK off 57: xid 2014786: flags 0x00
LOCK_ONLY EXCL_LOCK , blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     82/    82, tx:    2014786, lsn:
2/8DFE6020, prev 2/8DFE5FD0, desc: HOT_UPDATE off 57 xmax 2014786 flags
0x60 ; new off 41 xmax 2014786, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/8DFFA420, prev 2/8DFFA3F8, desc: PRUNE latestRemovedXid 2014786
nredirected 1 ndead 0, blkref #0: rel 1663/19243/19560 blk 540
000000010000000200000090:
rmgr: Heap2       len (rec/tot):     53/  7937, tx:          0, lsn:
2/90CEF528, prev 2/90CEF4E8, desc: VACUUM nunused 3, blkref #0: rel
1663/19243/19560 blk 540 FPW
rmgr: Heap2       len (rec/tot):     59/    59, tx:          0, lsn:
2/90CF1448, prev 2/90CEF528, desc: VISIBLE cutoff xid 2014786 flags
0x01, blkref #0: rel 1663/19243/19560 fork vm blk 0, blkref #1: rel
1663/19243/19560 blk 540
000000010000000200000093:
rmgr: Heap        len (rec/tot):     59/  7943, tx:    2045060, lsn:
2/93FF90E8, prev 2/93FF90B0, desc: LOCK off 41: xid 2045060: flags 0x00
LOCK_ONLY EXCL_LOCK KEYS_UPDATED , blkref #0: rel 1663/19243/19560 blk
540 FPW
000000010000000200000094:
rmgr: Heap        len (rec/tot):     99/    99, tx:    2045060, lsn:
2/94026D80, prev 2/94025150, desc: UPDATE off 41 xmax 2045060 flags 0x61
KEYS_UPDATED ; new off 5 xmax 2045060, blkref #0: rel 1663/19243/19560
blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/94031F28, prev 2/94031EF8, desc: PRUNE latestRemovedXid 2045060
nredirected 0 ndead 1, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     54/    54, tx:    2045062, lsn:
2/94031F68, prev 2/94031F28, desc: LOCK off 5: xid 2045062: flags 0x00
LOCK_ONLY EXCL_LOCK , blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     83/    83, tx:    2045062, lsn:
2/94031FA0, prev 2/94031F68, desc: HOT_UPDATE off 5 xmax 2045062 flags
0x60 ; new off 22 xmax 2045062, blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:          0, lsn:
2/94043C50, prev 2/94043C28, desc: PRUNE latestRemovedXid 2045062
nredirected 1 ndead 0, blkref #0: rel 1663/19243/19560 blk 540
000000010000000200000097:
rmgr: Heap        len (rec/tot):     73/  8133, tx:    2065110, lsn:
2/97207F18, prev 2/97207EE0, desc: UPDATE off 8 xmax 2065110 flags 0x00
; new off 41 xmax 2065110, blkref #0: rel 1663/19243/19560 blk 540 FPW,
blkref #1: rel 1663/19243/19560 blk 318
rmgr: Heap2       len (rec/tot):     53/  8109, tx:          0, lsn:
2/97ED2598, prev 2/97ED2558, desc: VACUUM nunused 1, blkref #0: rel
1663/19243/19560 blk 540 FPW
rmgr: Heap2       len (rec/tot):     59/    59, tx:          0, lsn:
2/97ED4560, prev 2/97ED2598, desc: VISIBLE cutoff xid 2065110 flags
0x01, blkref #0: rel 1663/19243/19560 fork vm blk 0, blkref #1: rel
1663/19243/19560 blk 540
0000000100000002000000A0:
rmgr: Heap        len (rec/tot):     59/  8115, tx:    2085600, lsn:
2/A0165A70, prev 2/A0165A38, desc: LOCK off 22: xid 2085600: flags 0x00
LOCK_ONLY EXCL_LOCK KEYS_UPDATED , blkref #0: rel 1663/19243/19560 blk
540 FPW
rmgr: Heap        len (rec/tot):     54/    54, tx:    2085600, lsn:
2/A018E858, prev 2/A018D7D8, desc: LOCK off 22: xid 2085600: flags 0x00
LOCK_ONLY EXCL_LOCK KEYS_UPDATED , blkref #0: rel 1663/19243/19560 blk 540
rmgr: Heap        len (rec/tot):     73/  8237, tx:    2085600, lsn:
2/A018E890, prev 2/A018E858, desc: UPDATE off 22 xmax 2085600 flags 0x03
KEYS_UPDATED ; new off 21 xmax 2085600, blkref #0: rel 1663/19243/19560
blk 328 FPW, blkref #1: rel 1663/19243/19560 blk 540
rmgr: Heap2       len (rec/tot):     58/    58, tx:    2085602, lsn:
2/A019DC20, prev 2/A019BC08, desc: PRUNE latestRemovedXid 2085600
nredirected 0 ndead 1, blkref #0: rel 1663/19243/19560 blk 540

--
K. R.

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2021-10-29 19:58:46 Re: BUG #17245: Index corruption involving deduplicated entries
Previous Message Juan José Santamaría Flecha 2021-10-29 19:43:35 Re: BUG #17254: Crash with 0xC0000409 in pg_stat_statements when pg_stat_tmp\pgss_query_texts.stat exceeded 2GB.