Re: BitmapHeapScan streaming read user and prelim refactoring

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Melanie Plageman <melanieplageman(at)gmail(dot)com>
Cc: Tomas Vondra <tomas(at)vondra(dot)me>, Heikki Linnakangas <hlinnaka(at)iki(dot)fi>, Thomas Munro <thomas(dot)munro(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>, Pg Hackers <pgsql-hackers(at)postgresql(dot)org>, Nazir Bilal Yavuz <byavuz81(at)gmail(dot)com>
Subject: Re: BitmapHeapScan streaming read user and prelim refactoring
Date: 2024-12-19 15:12:46
Message-ID: CAMbWs4859JX2-QnsNbgrMfiUSz+vV=poiVmj2rUyU-fB6oNHjA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 19, 2024 at 6:15 PM Richard Guo <guofenglinux(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2024-12-19 15:23:19 Re: BitmapHeapScan streaming read user and prelim refactoring
Previous Message Bertrand Drouvot 2024-12-19 15:07:17 Re: Removing the pgstat_flush_io() call from the walwriter