forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit82a5649
committed
Tighten use of OpenTransientFile and CloseTransientFile
This fixes two sets of issues related to the use of transient files inthe backend:1) OpenTransientFile() has been used in some code paths with read-writeflags while read-only is sufficient, so switch those calls to beread-only where necessary. These have been reported by Joe Conway.2) When opening transient files, it is up to the caller to close thefile descriptors opened. In error code paths, CloseTransientFile() getscalled to clean up things before issuing an error. However in normalexit paths, a lot of callers of CloseTransientFile() never actuallyreported errors, which could leave a file descriptor open withoutknowing about it. This is an issue I complained about a couple oftimes, but never had the courage to write and submit a patch, so here wego.Note that one frontend code path is impacted by this commit so as anerror is issued when fetching control file data, making backend andfrontend to be treated consistently.Reported-by: Joe Conway, Michael PaquierAuthor: Michael PaquierReviewed-by: Álvaro Herrera, Georgios Kokolatos, Joe ConwayDiscussion:https://postgr.es/m/20190301023338.GD1348@paquier.xyzDiscussion:https://postgr.es/m/c49b69ec-e2f7-ff33-4f17-0eaa4f2cef27@joeconway.com1 parent2e616de commit82a5649
File tree
17 files changed
+134
-30
lines changed- contrib/pg_stat_statements
- src
- backend
- access
- heap
- transam
- libpq
- replication
- logical
- storage
- file
- ipc
- utils/cache
- common
17 files changed
+134
-30
lines changedLines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1991 | 1991 |
| |
1992 | 1992 |
| |
1993 | 1993 |
| |
1994 |
| - | |
| 1994 | + | |
| 1995 | + | |
| 1996 | + | |
| 1997 | + | |
1995 | 1998 |
| |
1996 | 1999 |
| |
1997 | 2000 |
| |
|
Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1202 | 1202 |
| |
1203 | 1203 |
| |
1204 | 1204 |
| |
1205 |
| - | |
| 1205 | + | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
1206 | 1209 |
| |
1207 | 1210 |
| |
1208 | 1211 |
| |
| |||
1300 | 1303 |
| |
1301 | 1304 |
| |
1302 | 1305 |
| |
1303 |
| - | |
| 1306 | + | |
| 1307 | + | |
| 1308 | + | |
| 1309 | + | |
| 1310 | + | |
1304 | 1311 |
| |
1305 | 1312 |
| |
1306 | 1313 |
| |
|
Lines changed: 9 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
599 | 599 |
| |
600 | 600 |
| |
601 | 601 |
| |
602 |
| - | |
| 602 | + | |
603 | 603 |
| |
604 | 604 |
| |
605 | 605 |
| |
| |||
621 | 621 |
| |
622 | 622 |
| |
623 | 623 |
| |
624 |
| - | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
625 | 631 |
| |
626 | 632 |
| |
627 | 633 |
| |
| |||
654 | 660 |
| |
655 | 661 |
| |
656 | 662 |
| |
657 |
| - | |
| 663 | + | |
658 | 664 |
| |
659 | 665 |
| |
660 | 666 |
| |
|
Lines changed: 5 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
370 | 370 |
| |
371 | 371 |
| |
372 | 372 |
| |
373 |
| - | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
374 | 378 |
| |
375 | 379 |
| |
376 | 380 |
| |
| |||
416 | 420 |
| |
417 | 421 |
| |
418 | 422 |
| |
419 |
| - | |
420 | 423 |
| |
421 | 424 |
| |
422 | 425 |
| |
| |||
495 | 498 |
| |
496 | 499 |
| |
497 | 500 |
| |
498 |
| - | |
499 | 501 |
| |
500 | 502 |
| |
501 | 503 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1297 | 1297 |
| |
1298 | 1298 |
| |
1299 | 1299 |
| |
1300 |
| - | |
| 1300 | + | |
| 1301 | + | |
| 1302 | + | |
| 1303 | + | |
| 1304 | + | |
1301 | 1305 |
| |
1302 | 1306 |
| |
1303 | 1307 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3469 | 3469 |
| |
3470 | 3470 |
| |
3471 | 3471 |
| |
3472 |
| - | |
| 3472 | + | |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
3473 | 3476 |
| |
3474 | 3477 |
| |
3475 | 3478 |
| |
|
Lines changed: 12 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
455 | 455 |
| |
456 | 456 |
| |
457 | 457 |
| |
458 |
| - | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
459 | 464 |
| |
460 | 465 |
| |
461 | 466 |
| |
| |||
524 | 529 |
| |
525 | 530 |
| |
526 | 531 |
| |
527 |
| - | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
528 | 538 |
| |
529 | 539 |
| |
530 | 540 |
| |
|
Lines changed: 10 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
658 | 658 |
| |
659 | 659 |
| |
660 | 660 |
| |
661 |
| - | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
662 | 666 |
| |
663 | 667 |
| |
664 | 668 |
| |
| |||
793 | 797 |
| |
794 | 798 |
| |
795 | 799 |
| |
796 |
| - | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
797 | 805 |
| |
798 | 806 |
| |
799 | 807 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3360 | 3360 |
| |
3361 | 3361 |
| |
3362 | 3362 |
| |
3363 |
| - | |
| 3363 | + | |
| 3364 | + | |
| 3365 | + | |
| 3366 | + | |
3364 | 3367 |
| |
3365 | 3368 |
| |
3366 | 3369 |
| |
|
Lines changed: 9 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1651 | 1651 |
| |
1652 | 1652 |
| |
1653 | 1653 |
| |
1654 |
| - | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
| 1657 | + | |
| 1658 | + | |
1655 | 1659 |
| |
1656 | 1660 |
| |
1657 | 1661 |
| |
| |||
1846 | 1850 |
| |
1847 | 1851 |
| |
1848 | 1852 |
| |
1849 |
| - | |
| 1853 | + | |
| 1854 | + | |
| 1855 | + | |
| 1856 | + | |
1850 | 1857 |
| |
1851 | 1858 |
| |
1852 | 1859 |
| |
|
Lines changed: 10 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1315 | 1315 |
| |
1316 | 1316 |
| |
1317 | 1317 |
| |
1318 |
| - | |
| 1318 | + | |
| 1319 | + | |
| 1320 | + | |
| 1321 | + | |
| 1322 | + | |
1319 | 1323 |
| |
1320 | 1324 |
| |
1321 | 1325 |
| |
| |||
1377 | 1381 |
| |
1378 | 1382 |
| |
1379 | 1383 |
| |
1380 |
| - | |
| 1384 | + | |
1381 | 1385 |
| |
1382 | 1386 |
| |
1383 | 1387 |
| |
| |||
1477 | 1481 |
| |
1478 | 1482 |
| |
1479 | 1483 |
| |
1480 |
| - | |
| 1484 | + | |
| 1485 | + | |
| 1486 | + | |
| 1487 | + | |
1481 | 1488 |
| |
1482 | 1489 |
| |
1483 | 1490 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
521 | 521 |
| |
522 | 522 |
| |
523 | 523 |
| |
524 |
| - | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
525 | 529 |
| |
526 | 530 |
| |
527 | 531 |
| |
|
Lines changed: 4 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
218 | 218 |
| |
219 | 219 |
| |
220 | 220 |
| |
221 |
| - | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
222 | 225 |
| |
223 | 226 |
| |
224 | 227 |
|
Lines changed: 19 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
646 | 646 |
| |
647 | 647 |
| |
648 | 648 |
| |
649 |
| - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
650 | 657 |
| |
651 | 658 |
| |
652 | 659 |
| |
| |||
3295 | 3302 |
| |
3296 | 3303 |
| |
3297 | 3304 |
| |
3298 |
| - | |
| 3305 | + | |
| 3306 | + | |
| 3307 | + | |
| 3308 | + | |
3299 | 3309 |
| |
3300 | 3310 |
| |
3301 | 3311 |
| |
| |||
3394 | 3404 |
| |
3395 | 3405 |
| |
3396 | 3406 |
| |
3397 |
| - | |
| 3407 | + | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
3398 | 3414 |
| |
3399 | 3415 |
| |
3400 | 3416 |
| |
|
Lines changed: 9 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
916 | 916 |
| |
917 | 917 |
| |
918 | 918 |
| |
919 |
| - | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
920 | 928 |
| |
921 | 929 |
| |
922 | 930 |
| |
|
Lines changed: 5 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
747 | 747 |
| |
748 | 748 |
| |
749 | 749 |
| |
750 |
| - | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
751 | 755 |
| |
752 | 756 |
| |
753 | 757 |
| |
|
Lines changed: 11 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
100 | 100 |
| |
101 | 101 |
| |
102 | 102 |
| |
103 |
| - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
104 | 108 |
| |
105 |
| - | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
106 | 115 |
| |
107 | 116 |
| |
108 | 117 |
| |
|
0 commit comments
Comments
(0)