Re: [HACKERS] Parallel Bitmap scans a bit broken - Mailing list pgsql-hackers

From Dilip Kumar
Subject Re: [HACKERS] Parallel Bitmap scans a bit broken
Date
Msg-id CAFiTN-tpTHKM_HnzyUBRReLR6fvQwznYpTAw9B-TXC40ehcWyQ@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Parallel Bitmap scans a bit broken  (Dilip Kumar <dilipbalaut@gmail.com>)
Responses Re: [HACKERS] Parallel Bitmap scans a bit broken  (Robert Haas <robertmhaas@gmail.com>)
List pgsql-hackers
On Thu, Mar 9, 2017 at 10:02 PM, Dilip Kumar <dilipbalaut@gmail.com> wrote:
> I slightly modified your query to reproduce this issue.
>
> explain analyze select * from r1 where value<555;
>
> Patch is attached to fix the problem.

I forgot to mention the cause of the problem.

if (istate->schunkptr < istate->nchunks)
{  PagetableEntry *chunk = &ptbase[idxchunks[istate->schunkptr]];   PagetableEntry *page =
&ptbase[idxpages[istate->spageptr]];  BlockNumber chunk_blockno;
 

In above if condition we have only checked istate->schunkptr <
istate->nchunks that means we have some chunk left so we are safe to
access idxchunks,  But just after that we are accessing
ptbase[idxpages[istate->spageptr]] without checking that accessing
idxpages is safe or not.

tbm_iterator already handling this case, I broke it in tbm_shared_iterator.

-- 
Regards,
Dilip Kumar
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] partial indexes and bitmap scans
Next
From: Masahiko Sawada
Date:
Subject: Re: [HACKERS] GUC for cleanup indexes threshold.