Re: BUG #17268: Possible corruption in toast index after reindex index concurrently

From: Maxim Boguk <maxim(dot)boguk(at)gmail(dot)com>
To: Peter Geoghegan <pg(at)bowt(dot)ie>
Cc: Alexey Ermakov <alexey(dot)ermakov(at)dataegret(dot)com>, PostgreSQL mailing lists <pgsql-bugs(at)lists(dot)postgresql(dot)org>, Michael Paquier <michael(at)paquier(dot)xyz>
Subject: Re: BUG #17268: Possible corruption in toast index after reindex index concurrently
Date: 2021-11-04 18:07:28
Message-ID: CAK-MWwQBMWOwEJx+DCTnXOrqjg00wMbXwc60hkZD=Q9WmUsChg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, Nov 4, 2021 at 3:07 AM Peter Geoghegan <pg(at)bowt(dot)ie> wrote:
>
> On Wed, Nov 3, 2021 at 3:26 AM PG Bug reporting form
> <noreply(at)postgresql(dot)org> wrote:
> > it turns out one entry in toast index (?) was corrupted:
> > select md5(body) from zz where id = ...;
> > ERROR: missing chunk number 0 for toast value 4040061139 in
> > pg_toast_2624976286
> >
> > According to "created_at" column in linked table row was created at
> > "2021-11-02 13:04:22.192125", i.e. during reindex concurrently.
>
> I wonder if it's a coincidence that that number (~4.04 billion) is not
> that far from 2^32-1 (~4.294 billion).
>
> Can you run amcheck? Perhaps the output of the following will be interesting:
>
> create extension amcheck;
> set client_min_messages=debug1;
> select bt_index_check('pg_toast.pg_toast_2624976286_index', true);
>
> (Couldn't hurt to try it, at least.)

Hi Peter,

Please see a result of amcheck

select bt_index_check('pg_toast.pg_toast_2624976286_index', true);
DEBUG: verifying consistency of tree structure for index
"pg_toast_2624976286_index"
DEBUG: verifying level 3 (true root level)
DEBUG: verifying level 2
DEBUG: verifying level 1
DEBUG: verifying level 0 (leaf level)
DEBUG: leaf block 715360 of index "pg_toast_2624976286_index" has no
first data item
DEBUG: verifying that tuples from index "pg_toast_2624976286_index"
are present in "pg_toast_2624976286"
ERROR: heap tuple (59561917,1) from table "pg_toast_2624976286" lacks
matching index tuple within index "pg_toast_2624976286_index"
HINT: Retrying verification using the function
bt_index_parent_check() might provide a more specific error.

--
Maxim Boguk
Senior Postgresql DBA
https://dataegret.com/

Phone RU: +7 985 433 0000
Phone UA: +380 99 143 0000
Phone AU: +61 45 218 5678

LinkedIn: http://www.linkedin.com/pub/maksym-boguk/80/b99/b1b
Skype: maxim.boguk

"Доктор, вы мне советовали так не делать, но почему мне по-прежнему
больно когда я так делаю ещё раз?"

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Peter Geoghegan 2021-11-04 18:17:58 Re: BUG #17268: Possible corruption in toast index after reindex index concurrently
Previous Message Tom Lane 2021-11-04 14:42:38 Re: BUG #17271: Updating enum columns type fails when constraints exist