forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit4f37d09
committed
Avoid unlikely data-loss scenarios due to rename() without fsync.
Renaming a file using rename(2) is not guaranteed to be durable in faceof crashes. Use the previously added durable_rename()/durable_link_or_rename()in various places where we previously just renamed files.Most of the changed call sites are arguably not critical, but it seemsbetter to err on the side of too much durability. The most prominentknown case where the previously missing fsyncs could cause data loss iscrashes at the end of a checkpoint. After the actual checkpoint has beenperformed, old WAL files are recycled. When they're filled, theircontents are fdatasynced, but we did not fsync the containingdirectory. An OS/hardware crash in an unfortunate moment could then endup leaving that file with its old name, but new content; WAL replaywould thus not replay it.Reported-By: Tomas VondraAuthor: Michael Paquier, Tomas Vondra, Andres FreundDiscussion: 56583BDD.9060302@2ndquadrant.comBackpatch: All supported branches1 parent43b491a commit4f37d09
File tree
6 files changed
+18
-93
lines changed- contrib/pg_stat_statements
- src/backend
- access/transam
- postmaster
- utils/misc
6 files changed
+18
-93
lines changedLines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
735 | 735 |
| |
736 | 736 |
| |
737 | 737 |
| |
738 |
| - | |
739 |
| - | |
740 |
| - | |
741 |
| - | |
742 |
| - | |
| 738 | + | |
743 | 739 |
| |
744 | 740 |
| |
745 | 741 |
| |
|
Lines changed: 6 additions & 34 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
418 | 418 |
| |
419 | 419 |
| |
420 | 420 |
| |
421 |
| - | |
422 |
| - | |
423 |
| - | |
| 421 | + | |
| 422 | + | |
424 | 423 |
| |
425 |
| - | |
426 |
| - | |
427 |
| - | |
428 |
| - | |
429 |
| - | |
430 |
| - | |
431 |
| - | |
432 |
| - | |
433 |
| - | |
434 |
| - | |
435 |
| - | |
436 |
| - | |
437 |
| - | |
438 |
| - | |
| 424 | + | |
439 | 425 |
| |
440 | 426 |
| |
441 | 427 |
| |
| |||
508 | 494 |
| |
509 | 495 |
| |
510 | 496 |
| |
511 |
| - | |
512 |
| - | |
513 |
| - | |
| 497 | + | |
| 498 | + | |
514 | 499 |
| |
515 |
| - | |
516 |
| - | |
517 |
| - | |
518 |
| - | |
519 |
| - | |
520 |
| - | |
521 |
| - | |
522 |
| - | |
523 |
| - | |
524 |
| - | |
525 |
| - | |
526 |
| - | |
527 |
| - | |
528 |
| - | |
| 500 | + | |
529 | 501 |
| |
530 | 502 |
| |
531 | 503 |
| |
|
Lines changed: 7 additions & 33 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
3420 | 3420 |
| |
3421 | 3421 |
| |
3422 | 3422 |
| |
3423 |
| - | |
3424 |
| - | |
3425 |
| - | |
| 3423 | + | |
| 3424 | + | |
3426 | 3425 |
| |
3427 |
| - | |
3428 |
| - | |
| 3426 | + | |
3429 | 3427 |
| |
3430 | 3428 |
| |
3431 | 3429 |
| |
3432 |
| - | |
3433 |
| - | |
3434 |
| - | |
3435 |
| - | |
3436 |
| - | |
3437 |
| - | |
3438 |
| - | |
3439 |
| - | |
3440 |
| - | |
3441 |
| - | |
3442 |
| - | |
3443 |
| - | |
3444 |
| - | |
3445 |
| - | |
3446 |
| - | |
3447 |
| - | |
| 3430 | + | |
3448 | 3431 |
| |
3449 | 3432 |
| |
3450 |
| - | |
3451 | 3433 |
| |
3452 | 3434 |
| |
3453 | 3435 |
| |
| |||
5428 | 5410 |
| |
5429 | 5411 |
| |
5430 | 5412 |
| |
5431 |
| - | |
5432 |
| - | |
5433 |
| - | |
5434 |
| - | |
5435 |
| - | |
| 5413 | + | |
5436 | 5414 |
| |
5437 | 5415 |
| |
5438 | 5416 |
| |
| |||
6619 | 6597 |
| |
6620 | 6598 |
| |
6621 | 6599 |
| |
6622 |
| - | |
6623 |
| - | |
6624 |
| - | |
6625 |
| - | |
6626 |
| - | |
| 6600 | + | |
6627 | 6601 |
| |
6628 | 6602 |
| |
6629 | 6603 |
| |
| |||
10705 | 10679 |
| |
10706 | 10680 |
| |
10707 | 10681 |
| |
10708 |
| - | |
| 10682 | + | |
10709 | 10683 |
| |
10710 | 10684 |
| |
10711 | 10685 |
| |
|
Lines changed: 2 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
469 | 469 |
| |
470 | 470 |
| |
471 | 471 |
| |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
| 472 | + | |
477 | 473 |
| |
478 | 474 |
| |
479 | 475 |
| |
| |||
576 | 572 |
| |
577 | 573 |
| |
578 | 574 |
| |
579 |
| - | |
580 |
| - | |
581 |
| - | |
582 |
| - | |
583 |
| - | |
584 |
| - | |
| 575 | + | |
585 | 576 |
| |
586 | 577 |
| |
587 | 578 |
| |
|
Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
753 | 753 |
| |
754 | 754 |
| |
755 | 755 |
| |
756 |
| - | |
757 |
| - | |
758 |
| - | |
759 |
| - | |
760 |
| - | |
| 756 | + | |
761 | 757 |
|
Lines changed: 1 addition & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6817 | 6817 |
| |
6818 | 6818 |
| |
6819 | 6819 |
| |
6820 |
| - | |
6821 |
| - | |
6822 |
| - | |
6823 |
| - | |
6824 |
| - | |
| 6820 | + | |
6825 | 6821 |
| |
6826 | 6822 |
| |
6827 | 6823 |
| |
|
0 commit comments
Comments
(0)