| From: | Junwang Zhao <zhjwpku(at)gmail(dot)com> |
|---|---|
| To: | zengman <zengman(at)halodbtech(dot)com> |
| Cc: | Michael Paquier <michael(at)paquier(dot)xyz>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
| Subject: | Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure |
| Date: | 2026-02-02 03:26:44 |
| Message-ID: | CAEG8a3LxM9fKcQbh0_92CO8jP1sd5enUcKdozvxKbo6YtWDO+w@mail.gmail.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
On Mon, Feb 2, 2026 at 11:02 AM zengman <zengman(at)halodbtech(dot)com> wrote:
>
> > Likely so. This one should be backpatched, as the error generated
> > could be confusing if faced. That's very unlikely so, still.. I'll
> > look at other places in the tree for similar inconsistencies, while on
> > it.
>
> Hi Michael,
>
> Thank you for helping to address this! I’ve gone back and reviewed the code, and noticed `OpenWalSummaryFile`:
> ```
> File
> OpenWalSummaryFile(WalSummaryFile *ws, bool missing_ok)
> {
> char path[MAXPGPATH];
> File file;
>
> snprintf(path, MAXPGPATH,
> XLOGDIR "/summaries/%08X%08X%08X%08X%08X.summary",
> ws->tli,
> LSN_FORMAT_ARGS(ws->start_lsn),
> LSN_FORMAT_ARGS(ws->end_lsn));
>
> file = PathNameOpenFile(path, O_RDONLY);
> if (file < 0 && (errno != EEXIST || !missing_ok))
> ereport(ERROR,
> (errcode_for_file_access(),
> errmsg("could not open file \"%s\": %m", path)));
>
> return file;
> }
> ```
> I’m thinking of changing `errno != EEXIST` to `errno != ENOENT` here — would you think this adjustment is appropriate?
+1 for this change, per the function comment.
```
As an exception, if missing_ok = true and the trouble is specifically
that the file does not exist, it will not throw an error and will
return a value less than 0.
```
>
> --
> Regards,
> Man Zeng
--
Regards
Junwang Zhao
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Michael Paquier | 2026-02-02 03:34:03 | Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure |
| Previous Message | Xuneng Zhou | 2026-02-02 03:16:08 | Re: Improve read_local_xlog_page_guts by replacing polling with latch-based waiting |