Re: BUG #16619: Amcheck detects corruption in hstore' btree index (ver 2) - Mailing list pgsql-bugs

From Peter Geoghegan
Subject Re: BUG #16619: Amcheck detects corruption in hstore' btree index (ver 2)
Date
Msg-id CAH2-WzkSjsCHgs9YdBiFdC8iV_14rWO2R_VRsQaS_Mj-5H0Vnw@mail.gmail.com
Whole thread Raw
In response to Re: BUG #16619: Amcheck detects corruption in hstore' btree index (ver 2)  (Anastasia Lubennikova <a.lubennikova@postgrespro.ru>)
Responses Re: BUG #16619: Amcheck detects corruption in hstore' btree index (ver 2)  (Alexander Korotkov <aekorotkov@gmail.com>)
List pgsql-bugs
On Wed, Sep 16, 2020 at 7:24 AM Anastasia Lubennikova
<a.lubennikova@postgrespro.ru> wrote:
> For v2 indexes pivot tuple's offset can contain any random number which
> will lead to bt_pivot_tuple_identical() failure.
>
> The fix is pretty simple - only compare data part of the tuples. I think
> we can skip offnum check for all index versions to keep the code simple.

I pushed a tweaked version of this patch. It seemed worth preserving
the inclusion of offset number in the bt_pivot_tuple_identical()
memcmp() comparison. The field contains important metadata that really
should match. Also, I made sure to compare t_info field on all indexes
(including pg_upgrade'd indexes) for the same reason.

We already account for heapkeyspace difference in other similar
routines, such as invariant_l_offset().  It's not hard to do this here
as well.

Thanks
-- 
Peter Geoghegan



pgsql-bugs by date:

Previous
From: Jehan-Guillaume de Rorthais
Date:
Subject: Re: Inconsitancies in pg_stat_bgwriter and pg_stat_database returned values
Next
From: Nagaraj Raj
Date:
Subject: table partition with inheritance having current_timestamp issue if we miss range table