forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit10e3226
committed
Align blocks in incremental backups to BLCKSZ
Align blocks stored in incremental files to BLCKSZ, so that theincremental backups work well with CoW filesystems.The header of the incremental file is padded with \0 to a multiple ofBLCKSZ, so that the block data (also BLCKSZ) is aligned to BLCKSZ. Thepadding is added only to files containing block data, so files with justthe header remain small. This adds a bit of extra space, but as thenumber of blocks increases the overhead gets negligible very quickly.And as the padding is \0 bytes, it does compress extremely well.The alignment is important for CoW filesystems that usually require theblocks to be aligned to filesystem page size for features like blocksharing, deduplication etc. to work well. With the variable sized headerthe blocks in the increments were not aligned at all, negating thebenefits of the CoW filesystems.This matters even for non-CoW filesystems, for example when placed on aRAID array. If the block is not aligned, it may easily span multipledevices, causing read and write amplification.It might be better to align the blocks to the filesystem page, notBLCKSZ, but we have no good way to determine that. Even if we determinethe page size at the time of taking the backup, the backup may move. Fornow the BLCKSZ seems sufficient - the filesystem page is usually 4K, sothe default BLCKSZ (8K by default) is aligned to that.Author: Tomas VondraReviewed-by: Robert Haas, Jakub WartakDiscussion:https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com1 parentee1cbe8 commit10e3226
File tree
4 files changed
+70
-4
lines changed- src
- backend/backup
- bin/pg_combinebackup
- include/backup
4 files changed
+70
-4
lines changedLines changed: 26 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1623 | 1623 |
| |
1624 | 1624 |
| |
1625 | 1625 |
| |
| 1626 | + | |
| 1627 | + | |
1626 | 1628 |
| |
1627 | 1629 |
| |
1628 | 1630 |
| |
| |||
1635 | 1637 |
| |
1636 | 1638 |
| |
1637 | 1639 |
| |
| 1640 | + | |
| 1641 | + | |
| 1642 | + | |
| 1643 | + | |
| 1644 | + | |
| 1645 | + | |
| 1646 | + | |
| 1647 | + | |
| 1648 | + | |
| 1649 | + | |
| 1650 | + | |
| 1651 | + | |
| 1652 | + | |
| 1653 | + | |
| 1654 | + | |
| 1655 | + | |
| 1656 | + | |
1638 | 1657 |
| |
1639 | 1658 |
| |
1640 | 1659 |
| |
| |||
1748 | 1767 |
| |
1749 | 1768 |
| |
1750 | 1769 |
| |
| 1770 | + | |
| 1771 | + | |
| 1772 | + | |
| 1773 | + | |
| 1774 | + | |
| 1775 | + | |
| 1776 | + | |
1751 | 1777 |
| |
1752 | 1778 |
| |
1753 | 1779 |
| |
|
Lines changed: 35 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
928 | 928 |
| |
929 | 929 |
| |
930 | 930 |
| |
| 931 | + | |
| 932 | + | |
| 933 | + | |
| 934 | + | |
| 935 | + | |
| 936 | + | |
| 937 | + | |
| 938 | + | |
| 939 | + | |
| 940 | + | |
| 941 | + | |
| 942 | + | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
| 950 | + | |
| 951 | + | |
| 952 | + | |
| 953 | + | |
| 954 | + | |
| 955 | + | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
931 | 961 |
| |
932 | 962 |
| |
933 | 963 |
| |
| |||
940 | 970 |
| |
941 | 971 |
| |
942 | 972 |
| |
943 |
| - | |
944 |
| - | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
945 | 976 |
| |
946 |
| - | |
947 |
| - | |
| 977 | + | |
| 978 | + | |
948 | 979 |
| |
949 | 980 |
| |
950 | 981 |
| |
|
Lines changed: 8 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
472 | 472 |
| |
473 | 473 |
| |
474 | 474 |
| |
| 475 | + | |
| 476 | + | |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
475 | 483 |
| |
476 | 484 |
| |
477 | 485 |
| |
|
Lines changed: 1 addition & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
51 | 51 |
| |
52 | 52 |
| |
53 | 53 |
| |
| 54 | + | |
54 | 55 |
| |
55 | 56 |
|
0 commit comments
Comments
(0)