Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit a0d87bc

Browse filesBrowse files
committed
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 bb446b6 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
1 parent b8f44a4 commit a0d87bc
Copy full SHA for a0d87bc

File tree

Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+3
-2
lines changed

‎src/backend/utils/time/snapmgr.c

Copy file name to clipboardExpand all lines: src/backend/utils/time/snapmgr.c
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1391,8 +1391,9 @@ ImportSnapshot(const char *idstr)
13911391
f = AllocateFile(path, PG_BINARY_R);
13921392
if (!f)
13931393
ereport(ERROR,
1394-
(errcode(ERRCODE_INVALID_PARAMETER_VALUE),
1395-
errmsg("invalid snapshot identifier: \"%s\"", idstr)));
1394+
(errcode_for_file_access(),
1395+
errmsg("could not open file \"%s\" for reading: %m",
1396+
path)));
13961397

13971398
/* get the size of the file so that we know how much memory we need */
13981399
if (fstat(fileno(f), &stat_buf))

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.