Re: Have better wording for snapshot file reading failure

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: Have better wording for snapshot file reading failure
Дата
Msg-id ZQFUGOuS5DU4DsE4@paquier.xyz
обсуждение исходный текст
Ответ на Have better wording for snapshot file reading failure  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Ответы Re: Have better wording for snapshot file reading failure  (Daniel Gustafsson <daniel@yesql.se>)
Список pgsql-hackers
On Wed, Sep 13, 2023 at 11:40:25AM +0530, Bharath Rupireddy wrote:
> When a snapshot file reading fails in ImportSnapshot(), it errors out
> with "invalid snapshot identifier". This message better suits for
> snapshot identifier parsing errors which is being done just before the
> file reading. The attached patch adds a generic file reading error
> message with path to help distinguish if the issue is with snapshot
> identifier parsing or file reading.

     f = AllocateFile(path, PG_BINARY_R);
     if (!f)
         ereport(ERROR,
-                (errcode(ERRCODE_INVALID_PARAMETER_VALUE),
-                 errmsg("invalid snapshot identifier: \"%s\"", idstr)));
+                (errcode_for_file_access(),
+                 errmsg("could not open file \"%s\" for reading: %m",
+                        path)));

Agreed that this just looks like a copy-pasto.  The path provides
enough context about what's being read, so using this generic error
message is fine.  Will apply if there are no objections.
--
Michael

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bharath Rupireddy
Дата:
Сообщение: Have better wording for snapshot file reading failure
Следующее
От: Amit Kapila
Дата:
Сообщение: Re: persist logical slots to disk during shutdown checkpoint