aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/pgstatfuncs.c
diff options
context:
space:
mode:
authorMichael Paquier <michael@paquier.xyz>2023-09-19 10:19:50 +0900
committerMichael Paquier <michael@paquier.xyz>2023-09-19 10:19:50 +0900
commit78a33bba4c634afc3c67dddeb359b5ce872a0b04 (patch)
tree95b67a174157b2bc7a9010715546242b894fcb81 /src/backend/utils/adt/pgstatfuncs.c
parentaf5b3c3d1eae94e9584ad1955a20b5a7cd0083c1 (diff)
downloadpostgresql-78a33bba4c634afc3c67dddeb359b5ce872a0b04.tar.gz
postgresql-78a33bba4c634afc3c67dddeb359b5ce872a0b04.zip
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
Diffstat (limited to 'src/backend/utils/adt/pgstatfuncs.c')
0 files changed, 0 insertions, 0 deletions