Re: [sqlsmith] Failed assertion on pfree() viaperform_pruning_combine_step

Поиск
Список
Период
Сортировка
От Amit Langote
Тема Re: [sqlsmith] Failed assertion on pfree() viaperform_pruning_combine_step
Дата
Msg-id 18819903-bd1d-1ed9-f521-bb3f86b029b1@lab.ntt.co.jp
обсуждение исходный текст
Ответ на [sqlsmith] Failed assertion on pfree() via perform_pruning_combine_step  (Andreas Seltenreich <seltenreich@gmx.de>)
Ответы Re: [sqlsmith] Failed assertion on pfree() viaperform_pruning_combine_step  (Amit Langote <Langote_Amit_f8@lab.ntt.co.jp>)
Re: [sqlsmith] Failed assertion on pfree() viaperform_pruning_combine_step  (Alvaro Herrera <alvherre@alvh.no-ip.org>)
Список pgsql-hackers
Hi Andreas.

On 2018/04/08 3:33, Andreas Seltenreich wrote:
> Hi,
> 
> testing with master at 039eb6e92f yielded another query triggering an
> assertion.

Thanks for the report.

> Backtrace and query against the regression database below.
> #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
> #1  0x00007f25474cf42a in __GI_abort () at abort.c:89
> #2  0x0000556c14b75bb3 in ExceptionalCondition (
>     conditionName=conditionName@entry=0x556c14d11510 "!(((context) != ((void *)0) && (((((const
Node*)((context)))->type)== T_AllocSetContext) || ((((const Node*)((context)))->type) == T_SlabContext) || ((((const
Node*)((context)))->type)== T_Generatio"..., 
 
>     errorType=errorType@entry=0x556c14bcac95 "BadArgument", 
>     fileName=fileName@entry=0x556c14d11480 "../../../../src/include/utils/memutils.h",
lineNumber=lineNumber@entry=129)
>     at assert.c:54
> #3  0x0000556c14ba28cb in GetMemoryChunkContext (pointer=<optimized out>) at
../../../../src/include/utils/memutils.h:129
> #4  pfree (pointer=<optimized out>) at mcxt.c:1033
> #5  0x0000556c1495fc01 in bms_int_members (a=<optimized out>, b=<optimized out>) at bitmapset.c:917
> #6  0x0000556c149d910a in perform_pruning_combine_step (context=0x7ffe80889b20, step_results=0x7f253e3efcc0,
cstep=0x7f253e3f13a0)
>     at partprune.c:2697
> #7  get_matching_partitions (context=0x7ffe80889b20, pruning_steps=<optimized out>) at partprune.c:317
> #8  0x0000556c149d9596 in prune_append_rel_partitions (rel=rel@entry=0x7f253e3eb3e8) at partprune.c:262
> #9  0x0000556c14989e21 in set_append_rel_size (rte=0x7f254819d810, rti=2, rel=0x7f253e3eb3e8, root=0x7f254819d3c8) at
allpaths.c:907

[ <snipped> ]

> select
>   sample_0.dd as c0,
>   subq_1.c3 as c1,
>   subq_1.c0 as c2,
>   subq_1.c2 as c3,
>   subq_1.c3 as c4,
>   sample_0.bb as c5,
>   subq_1.c0 as c6,
>   pg_catalog.pg_current_wal_flush_lsn() as c7,
>   public.func_with_bad_set() as c8,
>   sample_0.bb as c9,
>   sample_0.aa as c10,
>   sample_0.dd as c11
> from
>   public.d as sample_0 tablesample bernoulli (2.8) ,
>   lateral (select
>     subq_0.c1 as c0,
>     sample_0.aa as c1,
>     subq_0.c0 as c2,
>     sample_0.cc as c3,
>     subq_0.c0 as c4,
>     subq_0.c1 as c5
>       from
>     (select
>           sample_1.a as c0,
>           (select s from public.reloptions_test limit 1 offset 2)
>          as c1
>         from
>           public.pagg_tab_ml as sample_1 tablesample system (3.6)
>         where ((((select c from public.test_tbl3 limit 1 offset 2)
>                <= cast(null as test_type3))
>           or (((select n from testxmlschema.test2 limit 1 offset 1)
>              <= true)
>             or (sample_0.bb is not NULL)))
>         and ((true)
>           or ((cast(null as varbit) >= (select varbitcol from public.brintest limit 1 offset 3)
>             )
>             and ((select macaddrcol from public.brintest limit 1 offset 6)
>              <> cast(null as macaddr)))))
>           or ((sample_1.a is NULL)
>         and ((sample_1.c is not NULL)
>           or (sample_1.c is NULL)))) as subq_0
>       where (select salary from public.rtest_emp limit 1 offset 3)
>        = (select pg_catalog.min(newsal) from public.rtest_emplog)
> 
>       limit 13) as subq_1
> where sample_0.aa is NULL
> limit 140;

I have reproduced this and found that the problem is that
perform_pruning_combine_step forgets to *copy* the bitmapset of the first
step in the handling of an COMBINE_INTERSECT step.

Attached fixes that.  I see that Michael Paquier has added this to the
open items list.  Thanks, Michael.

https://wiki.postgresql.org/wiki/PostgreSQL_11_Open_Items#Open_Issues

Thanks,
Amit

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: John Naylor
Дата:
Сообщение: Re: Verbosity of genbki.pl
Следующее
От: Amit Langote
Дата:
Сообщение: Re: [sqlsmith] Failed assertion on pfree() viaperform_pruning_combine_step