1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2024-12-12 10:04:14 +02:00
Commit Graph

2101 Commits

Author SHA1 Message Date
David Steele
a28b72c624
Add warning about using recovery type=none. 2023-05-18 09:32:44 +03:00
David Steele
c61115e8ad Add bundling and block incremental to stress testing.
This makes the stress testing more robust and provides additional testing for important features.
2023-05-15 17:46:41 +03:00
Reid Thompson
87087fac23
SFTP support for repository storage. 2023-05-13 19:16:16 +03:00
David Steele
0c1f823e7a Add note about running stanza-create on already-created repositories. 2023-05-12 15:46:04 +03:00
David Steele
ad9196cb49 Update Debian user guide to build on Ubuntu 20.04.
Ubuntu 18.04 will be EOL at the end of the month so update to a newer version.
2023-05-05 10:08:49 +03:00
David Steele
d49907239e Remove double spaces missed in 1bd5530a. 2023-05-03 09:37:59 +03:00
David Steele
1bd5530a59 Remove double spaces from comments and documentation.
Double spaces have fallen out of favor in recent years because they no longer contribute to readability.

We have been using single spaces and editing related paragraphs for some time, but now it seems best to update the remaining instances to avoid churn in unrelated commits and to make it clearer what spacing contributors should use.
2023-05-02 12:57:12 +03:00
David Steele
822f2a5842
Finalize block incremental feature.
Remove beta status and update documentation to remove beta references and warnings.

The repo-block-* sub-options have been marked internal. Most users will be best off with the default behavior and we may still decide to change these options for remove them in the future.
2023-05-01 19:26:48 +03:00
David Steele
c510046dd7 Remove extraneous spaces in user guide. 2023-05-01 14:27:56 +03:00
David Steele
dd4e52679e
Removing chunking and block numbers from incremental block list.
These were intended to allow the block list to be scanned without reading the map but were never utilized. They were left in "just in case" and because they did not seem to be doing any harm.

In fact, it is better not to have the block numbers because this allows us set the block size at a future time as long as it is a factor of the super block size. One way this could be useful is to store older files without super blocks or a map in the full backup and then build a map for them if the file gets modified in a diff/incr backup. This would require reading the file from the full backup to build the map but it would be more space efficient and we could make more intelligent decisions about block size. It would also be possible to change the block size even if one had already been selected in a prior backup.

Omitting the block numbers makes the chunking unnecessary since there is now no way to make sense of the block list without the map. Also, we might want to build maps for unchunked block lists, i.e. files that were copied normally.
2023-04-27 23:29:12 +03:00
David Steele
3fc3690dd7
PostgreSQL 16 Support.
Add catalog version and WAL magic for PostgreSQL 16.

The GUC to force parallel mode has be renamed so update that in the tests.
2023-04-27 10:30:50 +03:00
David Steele
3ff88ffbb4
Avoid chown() on recovery files during restore.
The chown() was already skipped on the files restored from the repository but the same logic was not applied to the generated recovery files, probably because chown'ing a few recovery files does not have performance implications. Use the same logic for recovery files to determined if they need to be chown'd.

Ultimately this behavior is pretty hard to test, so add a fail safe into the Posix driver that will skip chown if the permissions are already as required.
2023-04-25 11:52:28 +03:00
David Steele
f5e6bc2698
Allow page header checks to be skipped.
These checks cause false negatives for page checksum verification when the page is encrypted because pd_upper might end up as 0 in the encrypted data. This issue is rare but reproducible given a large enough cluster.

Make these checks optional, but leave them enabled by default.
2023-04-20 13:24:12 +03:00
David Steele
f33e1cfb16 Add error retry detail for HTTP retries.
This should make it clearer when retries have happened and for how long.
2023-04-06 11:38:18 +04:00
David Steele
801e396dac Move error modules to common/error directory.
There are already enough files to warrant a separate directory and more are coming.

Also remove extraneous includes.
2023-04-06 10:38:49 +04:00
David Steele
ff98636e41 Update 32-bit CI host to Debian 10 from Ubuntu 18.04.
Ubuntu 18.04 will be EOL before the next release, so update to the oldest available Debian version.

Also fix one incorrect return value type, a test cast, and adjust some test timeouts.
2023-04-06 08:22:14 +04:00
David Steele
a9f39857cf Remove unused strOS parameter in Common::HostTest. 2023-04-05 11:24:53 +04:00
David Steele
b111599bad Simplify object creation with OBJ_NEW_BEGIN() macro.
Eliminate the boilerplate of declaring this and assigning memory to it, which is the same for the vast majority of object creations.

Keep the old version of the macro as OBJ_NEW_BASE_BEGIN() for a few exceptions in the core code and (mostly) in the tests.
2023-03-28 15:05:18 +06:00
David Steele
8ff956ad7e Add lock module initialization.
Each call to lockAcquireP() passed enough information to initialize the lock system. This was somewhat inefficient and as locks become more complicated it will lead to more code duplication. Since a process can only take one type of lock it makes sense to do most of the initialization up front.

Also reduce the log level of lockRelease() since it is only called at exit and the lock will be released in any case.
2023-03-25 14:07:31 +07:00
David Steele
f1caecc4ff Convert lockAcquire() to lockAcquireP().
This makes a few current parameters optional and allows for more optional parameters with less code churn.
2023-03-24 10:34:42 +08:00
David Steele
c8ec114c8c Add reference filter and output to manifest command.
This allows the file list to be filtered by reference. The reference is output when it is not the default reference for the backup.
2023-03-21 12:29:45 +08:00
David Steele
5b5786c082 Begin v2.46 development. 2023-03-20 10:25:44 +08:00
David Steele
6ad79d16ca v2.45: Block Incremental Backup (BETA)
Bug Fixes:

* Skip writing recovery.signal by default for restores of offline backups. (Reviewed by Stefan Fercot. Reported by Marcel Borger.)

Features:

* Block incremental backup (BETA). (Reviewed by John Morris, Stephen Frost, Stefan Fercot.)

Improvements:

* Keep only one all-default group index. (Reviewed by Stefan Fercot.)

Documentation Improvements:

* Add explicit instructions for upgrading between 2.x versions. (Contributed by Christophe Courtois. Reviewed by David Steele.)
* Remove references to SSH made obsolete when TLS was introduced.
2023-03-20 09:37:23 +08:00
David Steele
04d224b88e Add beta feature and documentation for block incremental backup. 2023-03-18 20:47:03 +08:00
David Steele
c30d3e439b
Block incremental map fixes and improvements.
Bug Fixes:

* Remove the distinction between maps where super block size is equal to block size and maps where they are not. In practice, maps with equal blocks are now rare and most of the optimizations can be applied directly to super blocks where the blocks are equal. This fixes a bug where a map that was created with equal size blocks and then converted to differing block sizes would generate an invalid map.

* Free reads during restore to avoid running out of file handles.

Improvements:

* Store super block sizes in the block map. This allows the final block size to be removed from the block list and provides a more optimal restore and better potential for analysis.

* Always round the super block size up to the next block size. This makes the number of blocks per super block more predictable.

* Allow super block sizes to be changed at will in the map. The first case for this is to store the reduced super block size required when the last super block is short but it could be used to dynamically change the super block size to optimize compression.

* Store a block count rather than a list of blocks in a super block. Blocks must always be sequential, though there may be an offset to the first block in a super block. This saves 11-14% on space for checksum sizes 6-7.

* In the case that all the blocks for a super block are present, and there is no offset, the block size is omitted.
2023-03-14 17:48:25 +07:00
David Steele
5c1f78d4dd Fix typo in blockIncrProcess(). 2023-03-12 22:38:38 +07:00
David Steele
1281a6eaf8 Ensure no continuations when block size equals super block size.
In this case each super block contains a single block so continuations are not possible.
2023-03-12 16:21:43 +07:00
David Steele
24f725212d Add beta feature infrastructure.
This allows options to be marked as beta, which will require that the --beta option be supplied to prevent accidental usage of a beta feature.

The online and command-line documentation also show warnings when options are beta.
2023-03-10 15:30:27 +07:00
David Steele
6b409d049e Update default block size and super block values based on testing.
Block sizes are incremented when the size of the map becomes as large as a single block. This is arbitrary but it appears to give a good balance of block size vs map size.

The full backup super block size is set to minimize loss of compression efficiency since most blocks in the database will likely never be modified. For diff/incr backup super blocks, a smaller size is allowable since only modified blocks are stored. The overall savings of not storing unmodified blocks offsets the small loss in compression efficiency due to the smaller super block and allows more granular fetches during restore.
2023-03-10 14:01:38 +07:00
David Steele
1119a53539 Rename BlockHash to BlockChecksum.
Checksum is the generally used terminology in the code base, even when a hash is being used as a checksum.
2023-03-09 11:04:03 +07:00
David Steele
6252c0e448 Exclude backup set size from info for block incremental backups.
As calculated this size is not correct since it does not include the parts of prior block incrementals that are required to make the current block incremental valid. At best this could be approximated and the resulting values might be very confusing.

For now, at least, exclude this metric for block incremental backups.
2023-03-09 10:30:57 +07:00
David Steele
210bed4511 Use xxHash instead of SHA-1 for block incremental checksums.
xxHash is significantly faster than SHA-1 so this helps reduce the overhead of the feature.

A variable number of bytes are used from the xxHash depending on the block size with a minimum of six bytes for the smallest block size. This keeps the maps smaller while still providing enough bits to detect block changes.
2023-03-09 10:02:04 +07:00
David Steele
8b5153ad21
Block-level incremental backup super blocks.
Small blocks sizes can lead to reduced compression efficiency, so allow multiple blocks to be compressed together in a super block. The disadvantage is that the super block must be read sequentially to retrieve blocks. However, different super block sizes can be used for different backup types, so the full backup super block sizes are large for compression efficiency and diff/incr are smaller for retrieval efficiency.
2023-03-09 09:39:54 +07:00
Stefan Fercot
740c2258e3
Add pg-version-force option for fork integration.
Forks may update pg_control version or WAL magic without affecting the structures that pgBackRest depends on.

This option forces pgBackRest to treat a cluster as the specified version when it cannot be automatically identified.
2023-03-09 08:23:15 +07:00
David Steele
2fa7e53c5d
Skip writing recovery.signal by default for restores of offline backups.
When restoring an offline backup on PostgreSQL >= 12, skip writing recovery.signal by default since this will error if the backup was made with wal_level=minimal. If the user explicitly sets the type option to something other than none, then write recovery.signal as usual since it is possible to do Point-In-Time-Recovery from an offline backup as long as wal_level was not minimal.
2023-03-08 19:05:23 +07:00
David Steele
7e5adc0359 Use raw compression/encryption to bundling and block incremental backup.
Raw encryption was already being used for block incremental. This commit adds raw compression to block incremental where possible (see da918587).

Raw compression/encryption is also added to bundling for a backup set when block incremental is enabled on the full backup. This prevents a break in backward compatibility since block incremental is not backward compatible.
2023-03-07 18:46:24 +07:00
David Steele
da91858702 Add optional raw format for compression types.
Raw format saves 12 bytes of header for gzip and 4 bytes of checksum for lz4 (plus CPU overhead). This may not seem like much, but over millions of small files or incremental blocks can really add up. Even though it may be a relatively small percentage of the overall backup size it is still objectively a large amount of data.

Use raw format for protocol compression to exercise the feature.

Raw compression format will be added to bundling and block incremental in a followup commit.
2023-03-07 18:31:17 +07:00
David Steele
1648c133d6
Keep only one all-default group index.
It is possible for a group index to be created for an option that is later found to not meet dependencies. In this case all values would be default leading to a phantom group, which can be quite confusing.

Remove group indexes that are all default (except the final one) and make sure the key for the final all default group index is 1.
2023-03-04 12:45:08 +07:00
David Steele
16ac5ee8d3 Rename block incremental manifest keys.
Since the keys need to be read/written in order, these keys make the logic a bit simpler.
2023-02-26 16:13:44 +07:00
David Steele
a9867cb0b8 Add repo-block-age-map and repo-block-size-map options.
Make these options configurable. This is primarily for testing purposes so the new options will be kept internal.
2023-02-26 14:49:34 +07:00
Christophe Courtois
15d5dcdd3b
Add explicit instructions for upgrading between 2.x versions.
Add an explicit statement that there is nothing special to do when upgrading between 2.x versions.

Leave the previous paragraph about the default location that changed between 2.00 and 2.02, as it is more a matter of transitioning from 1.x to 2.x.
2023-02-26 14:41:32 +07:00
David Steele
dffc933384 Rename DeltaMap to BlockHash.
This more accurately describes what the object does.
2023-02-13 09:17:30 +07:00
David Steele
779efe0d7a Consistently declare block incremental size as size_t.
The block is often allocated in memory so size_t makes more sense than uint64_t.
2023-02-09 13:01:56 +07:00
David Steele
d520816acf Remove parameter list from deltaMapNew().
Since this filter cannot be used remotely (yet) there is no reason to create a parameter list.
2023-02-09 08:11:05 +07:00
David Steele
3feed389a2 Improve IoChunkedRead end-of-file handling.
Determine end-of-file earlier to improve throughput.

Also clean up some comments and formatting.
2023-02-08 22:34:23 +07:00
David Steele
089fae035b Add block incremental to real/all test output. 2023-02-07 14:09:50 +07:00
David Steele
8e7e9d36a1 Fix contributors in release notes. 2023-01-31 21:28:28 +07:00
David Steele
c5907a2e71 Remove references to SSH made obsolete when TLS was introduced.
Also remove details about SSH compression that are not helpful.
2023-01-31 08:28:32 +07:00
David Steele
ce0ea2cfab Use uncrustify for code formatting.
The code is not completely reflowed yet so there are some cases that uncrustify will not catch. The formatting will be improved over time.

Some block of code require special formatting so have been surrounded with the {uncrustify-off}/{uncrustify-on} markers. These exceptions should be kept to a minimum.

Add --code-format (to reformat code) and --code-format-check (to check formatting) to test.pl.

Add a CI test that will check code formatting. Code must be correctly formatted before it can be merge to integration.

Add documentation to the coding standards for code formatting.
2023-01-30 12:22:41 +07:00
David Steele
240312110c Begin v2.45 development. 2023-01-30 09:27:04 +07:00