postgres.git / summary / log / commit / refs
commit be3dfd3dff03b56ad283f14640440972c60c0588
Author: Michael Paquier <michael@paquier.xyz>
Date: Thu Sep 14 01:30:23 2023 +0000
First released in: master (reverted before release), REL_11_STABLE (reverted before release), REL_12_STABLE (reverted before release), REL_13_STABLE (reverted before release), REL_14_STABLE (reverted before release), REL_15_STABLE (reverted before release), REL_16_STABLE (reverted before release)
Reverted by: bddbbdf99b16 (in 11.22), 50d44c163352 (in 12.17), f18efc6f2bc8 (in 13.13), 1988f8766eeb (in 14.10), fe60434af76f (in 15.5), 3f94dfc00870 (in 16.1), be022908cfe2 (in 17.0)
Improve error message on snapshot import in snapmgr.c
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. This error message is reworded to be the same
as all the other messages used in this case on failure, which is useful
when debugging this area.
Thinko introduced by bb446b689b66 where snapshot imports have been
added. A backpatch down to 11 is done as this can improve any work
related to snapshot imports in older branches.
Author: Bharath Rupireddy
Reviewed-by: Daniel Gustafsson
Discussion: https://postgr.es/m/CALj2ACWmr=3KdxDkm8h7Zn1XxBoF6hdzq8WQyMn2y1OL5RYFrg@mail.gmail.com
Backpatch-through: 11
src/backend/utils/time/snapmgr.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/backend/utils/time/snapmgr.c b/src/backend/utils/time/snapmgr.c
index 3a419e348fa..5659ddaf31e 100644
--- a/src/backend/utils/time/snapmgr.c
+++ b/src/backend/utils/time/snapmgr.c
@@ -1445,8 +1445,9 @@ ImportSnapshot(const char *idstr)
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)));
/* get the size of the file so that we know how much memory we need */
if (fstat(fileno(f), &stat_buf))
[parent: 800d5bcb982b]