- Notifications
You must be signed in to change notification settings - Fork5
Commitf002ed2
committed
Improve error reporting in pg_upgrade's file copying/linking/rewriting.
The previous design for this had copyFile(), linkFile(), andrewriteVisibilityMap() returning strerror strings, with the callerproducing one-size-fits-all error messages based on that. This made itimpossible to produce messages that described the failures with any degreeof precision, especially not short-read problems since those don't seterrno at all.Since pg_upgrade has no intention of continuing after any error in thisarea, let's fix this by just letting these functions call pg_fatal() forthemselves, making it easy for each point of failure to have a suitableerror message. Taking this approach also allows dropping cleanup codethat was unnecessary and was often rather sloppy about preserving errno.To not lose relevant info that was reported before, pass in the schema nameand table name of the current table so that they can be included in theerror reports.An additional problem was the use of getErrorText(), which was flat outwrong for all but a couple of call sites, because it unconditionally did"_dosmaperr(GetLastError())" on Windows. That's only appropriate whenreporting an error from a Windows-native API, which only a couple ofthe callers were actually doing. Thus, even the reported strerror stringwould be unrelated to the actual failure in many cases on Windows.To fix, get rid of getErrorText() altogether, and just have call sitesdo strerror(errno) instead, since that's the way all the rest of ourfrontend programs do it. Add back the _dosmaperr() calls in the twoplaces where that's actually appropriate.In passing, make assorted messages hew more closely to project styleguidelines, notably by removing initial capitals in not-complete-sentenceprimary error messages. (I didn't make any effort to clean up placesI didn't have another reason to touch, though.)Per discussion of a report from Thomas Kellerer. Back-patch to 9.6,but no further; given the relative infrequency of reports of problemshere, it's not clear it's worth adapting the patch to older branches.Patch by me, but with credit to Alvaro Herrera for spotting the issuewith getErrorText's misuse of _dosmaperr().Discussion: <nsjrbh$8li$1@blaine.gmane.org>1 parent5afcd2a commitf002ed2
File tree
12 files changed
+132
-184
lines changed- src/bin/pg_upgrade
12 files changed
+132
-184
lines changedLines changed: 16 additions & 16 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
431 | 431 |
| |
432 | 432 |
| |
433 | 433 |
| |
434 |
| - | |
435 |
| - | |
| 434 | + | |
| 435 | + | |
436 | 436 |
| |
437 | 437 |
| |
438 | 438 |
| |
| |||
486 | 486 |
| |
487 | 487 |
| |
488 | 488 |
| |
489 |
| - | |
490 |
| - | |
| 489 | + | |
| 490 | + | |
491 | 491 |
| |
492 | 492 |
| |
493 | 493 |
| |
| |||
559 | 559 |
| |
560 | 560 |
| |
561 | 561 |
| |
562 |
| - | |
563 |
| - | |
| 562 | + | |
| 563 | + | |
564 | 564 |
| |
565 | 565 |
| |
566 | 566 |
| |
| |||
615 | 615 |
| |
616 | 616 |
| |
617 | 617 |
| |
618 |
| - | |
619 |
| - | |
| 618 | + | |
| 619 | + | |
620 | 620 |
| |
621 | 621 |
| |
622 | 622 |
| |
| |||
819 | 819 |
| |
820 | 820 |
| |
821 | 821 |
| |
822 |
| - | |
823 |
| - | |
| 822 | + | |
| 823 | + | |
824 | 824 |
| |
825 | 825 |
| |
826 | 826 |
| |
| |||
922 | 922 |
| |
923 | 923 |
| |
924 | 924 |
| |
925 |
| - | |
926 |
| - | |
| 925 | + | |
| 926 | + | |
927 | 927 |
| |
928 | 928 |
| |
929 | 929 |
| |
| |||
1013 | 1013 |
| |
1014 | 1014 |
| |
1015 | 1015 |
| |
1016 |
| - | |
1017 |
| - | |
| 1016 | + | |
| 1017 | + | |
1018 | 1018 |
| |
1019 | 1019 |
| |
1020 | 1020 |
| |
| |||
1089 | 1089 |
| |
1090 | 1090 |
| |
1091 | 1091 |
| |
1092 |
| - | |
1093 |
| - | |
| 1092 | + | |
| 1093 | + | |
1094 | 1094 |
| |
1095 | 1095 |
| |
1096 | 1096 |
| |
|
Lines changed: 2 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
119 | 119 |
| |
120 | 120 |
| |
121 | 121 |
| |
122 |
| - | |
123 |
| - | |
| 122 | + | |
| 123 | + | |
124 | 124 |
| |
125 | 125 |
| |
126 | 126 |
| |
|
Lines changed: 4 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
191 | 191 |
| |
192 | 192 |
| |
193 | 193 |
| |
194 |
| - | |
| 194 | + | |
195 | 195 |
| |
196 | 196 |
| |
197 | 197 |
| |
| |||
285 | 285 |
| |
286 | 286 |
| |
287 | 287 |
| |
288 |
| - | |
| 288 | + | |
289 | 289 |
| |
290 | 290 |
| |
291 | 291 |
| |
| |||
309 | 309 |
| |
310 | 310 |
| |
311 | 311 |
| |
312 |
| - | |
| 312 | + | |
313 | 313 |
| |
314 | 314 |
| |
315 | 315 |
| |
| |||
352 | 352 |
| |
353 | 353 |
| |
354 | 354 |
| |
355 |
| - | |
| 355 | + | |
356 | 356 |
| |
357 | 357 |
| |
358 | 358 |
| |
|
0 commit comments
Comments
(0)