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: 2021-04-04T17:52:50Z
Lists: pgsql-hackers
On 4/4/21 7:25 AM, Jaime Casanova wrote: > ... > Changing to using month of 30 days on the formula fixed it. > I've pushed fixes for all the bugs reported in this thread so far (mostly distance calculations, ...), and one bug (swapped operator parameters in one place) I discovered while working on the fixes. > and I found another issue, this time involves autovacuum which makes it > a little more complicated to reproduce. > > Currently the only stable way to reproduce it is using pgbench: > > pgbench -i postgres > psql -c "CREATE INDEX ON pgbench_history USING brin (tid int4_minmax_multi_ops);" postgres > pgbench -c2 -j2 -T 300 -n postgres > Fixed and pushed too. Turned out to be a silly bug in forgetting to remember the number of ranges after deduplication, which sometimes resulted in assert failure. It's a bit hard to trigger because concurrency / good timing is needed while summarizing the range, requiring a call to "union" function. Just running the pgbench did not trigger the issue for me, I had to manually call the brin_summarize_new_values(). For the record, I did a lot of testing with data randomized in various ways - the scripts are available here: https://github.com/tvondra/brin-randomized-tests It was focused on discovering issues in the distance functions, and comparing results with/without the index. Maybe the next step should be adding some changes to the data, which might trigger more issues like this one. regards -- Tomas Vondra EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company
Commits
-
Fix assert in BRIN build_distances
- 02699bc1fd3b 16.0 landed
- c4f64cfab9fe 15.2 landed
- 883dc0214a64 14.7 landed
-
Fix bug in brin_minmax_multi_union
- d9c5b9a9eeb9 14.0 landed
-
Fix order of parameters in BRIN minmax-multi calls
- 1dad2a5ea3d1 14.0 landed
-
Fix BRIN minmax-multi distance for inet type
- e1fbe1181c86 14.0 landed
-
Fix BRIN minmax-multi distance for timetz type
- 7262f2421a1e 14.0 landed
-
Fix BRIN minmax-multi distance for interval type
- 2b10e0e3c2ca 14.0 landed