Re: [Patch] remove duplicated smgrclose

Junwang Zhao <zhjwpku@gmail.com>

From: Junwang Zhao <zhjwpku@gmail.com>
To: Steven Niu <niushiji@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>, Kirill Reshke <reshkekirill@gmail.com>, pgsql-hackers@lists.postgresql.org
Date: 2025-03-11T01:38:13Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Give SMgrRelation pointers a well-defined lifetime.

>
>  Hi, Masahiko
>
> Thanks for your comments! I understand your concern as you stated.
> However, my initial patch was split into two parts as Kirill suggested.
> This thread is about the first part. Another part is here: https://commitfest.postgresql.org/patch/5149/
> Or you can take a look at the v2-0001-remove-duplicated-smgrclose.patch in this thread for the complete change.
>
> I think either we review the v2-patch, or review the both 5149 and 5196 CFs, for my complete change.
> There should be no missing operations.

@@ -482,13 +482,11 @@ smgrdounlinkall(SMgrRelation *rels, int nrels,
bool isRedo)
  for (i = 0; i < nrels; i++)
  {
  RelFileLocatorBackend rlocator = rels[i]->smgr_rlocator;
- int which = rels[i]->smgr_which;

  rlocators[i] = rlocator;

  /* Close the forks at smgr level */
- for (forknum = 0; forknum <= MAX_FORKNUM; forknum++)
- smgrsw[which].smgr_close(rels[i], forknum);
+ smgrclose(rels[i]);
  }

Yeah, you are adjusting the behavior by moving the `smgrclose` operation
after the `smgrdounlinkall` to the `smgrdounlinkall` function itself.

Seems no missing operations in v2-patch. Thanks.

>
> Please let me know if you have more comments.
>
> Best Regards,
> Steven



-- 
Regards
Junwang Zhao