Re: Use function smgrclose() to replace the loop - Mailing list pgsql-hackers

From Junwang Zhao
Subject Re: Use function smgrclose() to replace the loop
Date
Msg-id CAEG8a3+o7Eh_6L+YA0vTXnNMcF1hgb3uRD7kRk+oUNhpf4+nQg@mail.gmail.com
Whole thread Raw
In response to Re: Use function smgrclose() to replace the loop  (Ilia Evdokimov <ilya.evdokimov@tantorlabs.com>)
Responses Re: Use function smgrclose() to replace the loop
List pgsql-hackers
On Mon, Oct 14, 2024 at 6:30 PM Ilia Evdokimov
<ilya.evdokimov@tantorlabs.com> wrote:
>
>
> On 14.08.2024 09:32, Steven Niu wrote:
> > Hi, Kirill, Junwang,
> >
> > I made this patch to address the refactor issue in our previous email
> > discussion.
> > https://www.postgresql.org/message-id/flat/CABBtG=cDTCBDCBK7McSy6bJR3s5xUTOg0vSFfuW8oLdUYyCscA@mail.gmail.com
> >
> >
> > That is, the for loop in function smgrdestroy() and smgrdounlinkall
> > can be replaced with smgrclose().
> >
> > for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
> >     smgrsw[reln->smgr_which].smgr_close(reln, forknum);
> > -->
> > smgrclose(rels[i]);
> >
> > Please let me know if you have any questions.
> >
> > Best Regards,
> > Steven from Highgo.com
>
> Hello,
>
> Are you sure we can refactor loop by 'smgrclose()'? I see it is not
> quite the same.

smgrclose does more by setting smgr_cached_nblocks[] and smgr_targblock
to InvalidBlockNumber, I see no harm with the replacement, not 100% sure
though.

>
> Regards,
> Ilia Evdokimov,
> Tantor Labs LLC.
>


--
Regards
Junwang Zhao



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: New function normal_rand_array function to contrib/tablefunc.
Next
From: Amit Kapila
Date:
Subject: Re: Conflict detection for update_deleted in logical replication