Re: Crash in BRIN minmax-multi indexes

Tomas Vondra <tomas.vondra@enterprisedb.com>

From: Tomas Vondra <tomas.vondra@enterprisedb.com>
To: Jaime Casanova <jcasanov@systemguards.com.ec>
Cc: Zhihong Yu <zyu@yugabyte.com>, PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-10-03T17:53:34Z
Lists: pgsql-hackers
On 9/29/22 08:53, Jaime Casanova wrote:
> ...
> 
> Just found one more ocurrance of this one with this index while an
> autovacuum was running:
> 
> """
> CREATE INDEX bt_f8_heap_seqno_idx 
>     ON public.bt_f8_heap 
>     USING brin (seqno float8_minmax_multi_ops);
> """
> Attached is a backtrace.

Thanks for the report!

I think I see the issue - brin_minmax_multi_union does not realize the
two summaries could have just one range each, and those can overlap so
that merge_overlapping_ranges combines them into a single one.

This is harmless, except that the assert int build_distances is overly
strict. Not sure if we should just remove the assert or only compute the
distances with (neranges>1).

Do you happen to have the core dump? It'd be useful to look at ranges_a
and ranges_b, to confirm this is indeed what's happening.

If not, how reproducible is it?


regards

-- 
Tomas Vondra
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company



Commits

  1. Fix assert in BRIN build_distances

  2. Fix bug in brin_minmax_multi_union

  3. Fix order of parameters in BRIN minmax-multi calls

  4. Fix BRIN minmax-multi distance for inet type

  5. Fix BRIN minmax-multi distance for timetz type

  6. Fix BRIN minmax-multi distance for interval type