forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit78a33bb
committed
Improve error message for snapshot import in snapmgr.c, take two
When a snapshot file fails to be read in ImportSnapshot(), it wouldissue an ERROR as "invalid snapshot identifier" when opening a streamfor it in read-only mode. The error handling is improved to be moretalkative in failure cases:- If a snapshot identifier uses incorrect characters, complain with thesame 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 whereAllocateFile() fails on ENOENT. Based on a suggestion from AndresFreund.- If AllocateFile() throws something else than ENOENT as errno, reportit with more details in %m instead, as these failures are neverexpected.b29504eeb489 was the first improvement take. The older error messageexists sincebb446b6 that introduced snapshot imports. Two testcases are added to cover the cases of an identifier with an incorrectformat and of a missing snapshot.Author: Bharath RupireddyReviewed-by: Andres Freund, Daniel Gustafsson, Michael PaquierDiscussion:https://postgr.es/m/CALj2ACWmr=3KdxDkm8h7Zn1XxBoF6hdzq8WQyMn2y1OL5RYFrg@mail.gmail.com1 parentaf5b3c3 commit78a33bb
File tree
3 files changed
+35
-3
lines changed- src
- backend/utils/time
- test/regress
- expected
- sql
3 files changed
+35
-3
lines changedLines changed: 15 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1390 | 1390 |
| |
1391 | 1391 |
| |
1392 | 1392 |
| |
1393 |
| - | |
1394 |
| - | |
1395 |
| - | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
1396 | 1408 |
| |
1397 | 1409 |
| |
1398 | 1410 |
| |
|
Lines changed: 11 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1148 | 1148 |
| |
1149 | 1149 |
| |
1150 | 1150 |
| |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
| 1156 | + | |
| 1157 | + | |
| 1158 | + | |
| 1159 | + | |
| 1160 | + | |
| 1161 | + | |
1151 | 1162 |
| |
1152 | 1163 |
| |
1153 | 1164 |
| |
|
Lines changed: 9 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
613 | 613 |
| |
614 | 614 |
| |
615 | 615 |
| |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
616 | 625 |
| |
617 | 626 |
| |
618 | 627 |
| |
|
0 commit comments
Comments
(0)