pgsql: Improve error message for snapshot import in snapmgr.c, take two

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема pgsql: Improve error message for snapshot import in snapmgr.c, take two
Дата
Msg-id E1qiPTh-004fFq-Qm@gemulon.postgresql.org
обсуждение исходный текст
Список pgsql-committers
Improve error message for snapshot import in snapmgr.c, take two

When a snapshot file fails to be read in ImportSnapshot(), it would
issue an ERROR as "invalid snapshot identifier" when opening a stream
for it in read-only mode.  The error handling is improved to be more
talkative in failure cases:
- If a snapshot identifier uses incorrect characters, complain with the
same error as before this commit.
- If the snapshot file cannot be found in pg_snapshots/, complain with a
"snapshot \"foo\" does not exist" instead.  This maps to the case where
AllocateFile() fails on ENOENT.  Based on a suggestion from Andres
Freund.
- If AllocateFile() throws something else than ENOENT as errno, report
it with more details in %m instead, as these failures are never
expected.

b29504eeb489 was the first improvement take.  The older error message
exists since bb446b689b66 that introduced snapshot imports.  Two test
cases are added to cover the cases of an identifier with an incorrect
format and of a missing snapshot.

Author: Bharath Rupireddy
Reviewed-by: Andres Freund, Daniel Gustafsson, Michael Paquier
Discussion: https://postgr.es/m/CALj2ACWmr=3KdxDkm8h7Zn1XxBoF6hdzq8WQyMn2y1OL5RYFrg@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/78a33bba4c634afc3c67dddeb359b5ce872a0b04

Modified Files
--------------
src/backend/utils/time/snapmgr.c           | 18 +++++++++++++++---
src/test/regress/expected/transactions.out | 11 +++++++++++
src/test/regress/sql/transactions.sql      |  9 +++++++++
3 files changed, 35 insertions(+), 3 deletions(-)


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

Предыдущее
От: Michael Paquier
Дата:
Сообщение: pgsql: Fix assertion failure with PL/Python exceptions
Следующее
От: Peter Eisentraut
Дата:
Сообщение: pgsql: Standardize type of extend_by counter