Re: BitmapHeapScan streaming read user and prelim refactoring - Mailing list pgsql-hackers

From Melanie Plageman
Subject Re: BitmapHeapScan streaming read user and prelim refactoring
Date
Msg-id CAAKRu_YN2eqixcdAZmb1F-1ggaKJ=Bo8je3SnukTW0cEWighvQ@mail.gmail.com
Whole thread Raw
In response to Re: BitmapHeapScan streaming read user and prelim refactoring  (Melanie Plageman <melanieplageman@gmail.com>)
List pgsql-hackers
On Thu, Dec 19, 2024 at 10:23 AM Melanie Plageman
<melanieplageman@gmail.com> wrote:
>
> On Thu, Dec 19, 2024 at 10:12 AM Richard Guo <guofenglinux@gmail.com> wrote:
> >
> > On Thu, Dec 19, 2024 at 6:15 PM Richard Guo <guofenglinux@gmail.com> wrote:
> > > I think we need to check whether rs_tbmiterator is NULL before calling
> > > tbm_end_iterate on it, like below.
> > >
> > > --- a/src/backend/executor/nodeBitmapHeapscan.c
> > > +++ b/src/backend/executor/nodeBitmapHeapscan.c
> > > @@ -572,9 +572,11 @@ ExecReScanBitmapHeapScan(BitmapHeapScanState *node)
> > >     if (scan)
> > >     {
> > >         /*
> > > -        * End iteration on iterators saved in scan descriptor.
> > > +        * End iteration on iterators saved in scan descriptor, if they
> > > +        * haven't already been cleaned up.
> > >          */
> > > -       tbm_end_iterate(&scan->st.rs_tbmiterator);
> > > +       if (!tbm_exhausted(&scan->st.rs_tbmiterator))
> > > +           tbm_end_iterate(&scan->st.rs_tbmiterator);
> > >
> > >         /* rescan to release any page pin */
> > >         table_rescan(node->ss.ss_currentScanDesc, NULL);
> >
> > This change may also be needed in ExecEndBitmapHeapScan().
>
> Thanks, Richard! I'm working on the fix and adding the test case you found.

Okay, pushed. Thanks so much, Richard. I also noticed another
oversight and fixed it.

- Melanie



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Remaining dependency on setlocale()
Next
From: Masahiko Sawada
Date:
Subject: Re: Memory leak in WAL sender with pgoutput (v10~)