Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure - Mailing list pgsql-hackers

From Michael Paquier
Subject Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure
Date
Msg-id aYAbKwRWAP5nWFgj@paquier.xyz
Whole thread Raw
In response to Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure  ("zengman" <zengman@halodbtech.com>)
Responses Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure
List pgsql-hackers
On Mon, Feb 02, 2026 at 11:02:39AM +0800, zengman wrote:
> 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?

Funny timing.  I've spotted the exact same thing while double-checking
the file two hours ago, where EEXIST should be replaced by ENOENT.  I
was going to spawn a new thread about that with Robert in CC.
--
Michael

Attachment

pgsql-hackers by date:

Previous
From: Junwang Zhao
Date:
Subject: Re: [PATCH] Fix error message in RemoveWalSummaryIfOlderThan to indicate file removal failure
Next
From: Michael Paquier
Date:
Subject: Incorrect errno used in OpenWalSummaryFile()