postgresql/src/bin
Tomas Vondra 10e3226ba1 Align blocks in incremental backups to BLCKSZ
Align blocks stored in incremental files to BLCKSZ, so that the
incremental backups work well with CoW filesystems.

The header of the incremental file is padded with \0 to a multiple of
BLCKSZ, so that the block data (also BLCKSZ) is aligned to BLCKSZ. The
padding is added only to files containing block data, so files with just
the header remain small. This adds a bit of extra space, but as the
number 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 the
blocks to be aligned to filesystem page size for features like block
sharing, deduplication etc. to work well. With the variable sized header
the blocks in the increments were not aligned at all, negating the
benefits of the CoW filesystems.

This matters even for non-CoW filesystems, for example when placed on a
RAID array. If the block is not aligned, it may easily span multiple
devices, causing read and write amplification.

It might be better to align the blocks to the filesystem page, not
BLCKSZ, but we have no good way to determine that. Even if we determine
the page size at the time of taking the backup, the backup may move. For
now the BLCKSZ seems sufficient - the filesystem page is usually 4K, so
the default BLCKSZ (8K by default) is aligned to that.

Author: Tomas Vondra
Reviewed-by: Robert Haas, Jakub Wartak
Discussion: https://postgr.es/m/3024283a-7491-4240-80d0-421575f6bb23%40enterprisedb.com
2024-04-05 16:30:01 +02:00
..
initdb Fix test failures when language environment is not UTF-8. 2024-04-04 16:10:12 -07:00
pg_amcheck Escape output of pg_amcheck test 2024-01-13 20:32:18 +01:00
pg_archivecleanup Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_basebackup Fix assorted resource leaks in new pg_createsubscriber code. 2024-04-01 13:47:49 -04:00
pg_checksums Skip .DS_Store files in server side utils 2024-02-13 13:47:12 +01:00
pg_combinebackup Align blocks in incremental backups to BLCKSZ 2024-04-05 16:30:01 +02:00
pg_config Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_controldata Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_ctl Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_dump Add functions to binaryheap for efficient key removal and update. 2024-04-03 10:44:21 +09:00
pg_resetwal Activate perlcritic InputOutput::RequireCheckedSyscalls and fix resulting warnings 2024-03-19 07:09:31 +01:00
pg_rewind Allow dbname to be written as part of connstring via pg_basebackup's -R option. 2024-03-21 10:50:33 +05:30
pg_test_fsync Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_test_timing Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_upgrade pg_upgrade: Fix typo in message 2024-04-04 12:58:57 +02:00
pg_verifybackup Use incremental parsing of backup manifests. 2024-04-04 06:46:40 -04:00
pg_waldump Update copyright for 2024 2024-01-03 20:49:05 -05:00
pg_walsummary Revert "Temporary patch to help debug pg_walsummary test failures." 2024-03-20 11:34:00 -05:00
pgbench Adjust pgbench option for debug mode. 2024-03-25 11:08:53 -05:00
pgevent Update copyright for 2024 2024-01-03 20:49:05 -05:00
psql Remove reachable call to pg_unreachable(). 2024-04-04 16:22:11 -04:00
scripts Fix test failures when language environment is not UTF-8. 2024-04-04 16:10:12 -07:00
Makefile Add new pg_walsummary tool. 2024-01-11 12:48:27 -05:00
meson.build Add new pg_walsummary tool. 2024-01-11 12:48:27 -05:00