1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2026-06-20 01:17:49 +02:00
Commit Graph

4719 Commits

Author SHA1 Message Date
David Steele 9653d444f2 Use roles to simplify option command lists.
In many cases the valid commands are based on the commands valid for roles. In these cases derive the commands from a role list rather than an explicit command list.

Not only is this notation more compact but it helps prevent new commands from being missed.

This exposed a few issues:

1) The cmd option should only be valid when a command supports the local role since it is used to execute the local process. A number of commands were included before that did not have the local role.

2) cmd-ssh should be valid for any command that allows remotes. The annotate command was missing from this list.

3) compress-level-network should be valid for any command that allows remotes. The repo-rm command was missing from this list.
2025-11-11 09:44:41 +02:00
David Steele 411c1d0a87 Cleanup pg-host options for unsupported remote restore.
Restoring to a remote pg-host is not supported but the options were a bit untidy. Many options were marked as internal but should be invalid. repo-host-type and repo-host are required to let restore know if a pg-host is configured and remain internal but the rest of the pg-host-* options are now invalid for restore.

The same applies to the archive-get and archive-push commands although these were less likely to cause confusion.

Also reverse the dependency of pg-host and pg-host-type, i.e. make pg-host-type depend on pg-host, and alter pg-host-cmd and pg-host-user to depend on pg-host-type=ssh.
2025-11-11 09:09:15 +02:00
David Steele 9be51f9bf3 Cleanup repo-host options for remote backup.
931435c0 added the ability to backup to a remote repo but did not quite get the option updates right. It worked, but a number of options were marked as internal so would not be visible to the user in command-line help.

Also reverse the dependency of repo-host and repo-host-type, i.e. make repo-host-type depend on repo-host, and alter repo-host-cmd and repo-host-user to depend on repo-host-type=ssh.
2025-11-11 08:52:36 +02:00
David Steele 7a74fd3fb9 Show internal state for commands/options in parse.auto.c.inc.
Previously internal state was not included because it does not affect how commands/options are used -- only whether they are shown in help. However, this makes it hard to know when the internal state changes because help is generated at build time and in any case is just a binary blob.

Internal state is not stored in the config structures since the macros resolve to nothing but it is handy for debugging to see when internal state has changed.
2025-11-10 20:05:42 +02:00
David Steele 40381c2fe8 Remove overly verbose command role rules.
The default rules work for most commands so use them. Exceptions for the repo option remain.
2025-11-10 19:54:05 +02:00
David Steele 2f4765c6fa Remove unused start/stop commands on repo options.
The logic defined start/stop as being valid for no roles but it is simpler to just omit them.
2025-11-10 19:34:48 +02:00
David Steele 91281b7144 Migrate document command/option description preprocessing to C.
The Perl processing of config.yaml put hard limits on the format of that file. To allow flexibility in the file format remove all Perl processing on config.yaml.

This is just the beginning of migrating the preprocessor to C but even this small bit allows the removal of a lot of Perl code.
2025-11-10 12:28:05 +02:00
David Steele 186ed610b5 Remove redundant command lists from src/build/config/config.yaml.
When not specified, the command list is generated based on all commands valid for the specified roles.
2025-11-09 13:59:20 +02:00
David Steele ff64ad688e Use get_option() for tasks supported by the new meson version.
55e9969 updated the meson version but only reverted one of the changes implemented in 0eccbc8 where the version was lowered to >= 0.45.

Use get_option() as allowed by the updated version for clearer and more robust build code.
2025-11-08 15:43:12 +02:00
David Steele 5171e8bde3 Remove support for PostgreSQL 9.5.
Per our policy to support five EOL versions of PostgreSQL, 9.5 is no longer supported by pgBackRest. Remove all logic associated with 9.5 and update the tests.

An effort was made to advance versions as much as possible in the tests while still providing coverage. Hopefully this will reduce churn when future versions expire, though it has created a bit more here.

Tests for 9.4/9.5 are left in the expire/info tests to demonstrate that these commands work with old versions present.
2025-11-07 10:01:50 +02:00
David Steele 1f2b2778ab Fix incorrect pg_control struct used for PostgreSQL 9.5.
The 9.6 pg_control struct was being used for 9.5. This was not detected by testing because the new field introduced for 9.6 fit into an alignment hole in the 9.5 struct so the size of the struct and offset of all other members did not change. Since the new member was not used there was no impact on functionality.

9.5 is being removed in the next release so the only reason to fix this is to make the diff for that change more sensible, and to document that this happened.
2025-11-06 10:21:23 +02:00
David Steele 1c976ded91 Remove versioning from static types used by versioned PostgreSQL types.
Some of these types were versioned at one time. Others were not but it seemed better to version all of them for consistency. In fact this just creates churn when PostgreSQL versions are expired.

Also move the uint64 type to version.vendor.h since it is only used by versioned types.
2025-11-05 23:18:29 +02:00
David Steele 339f4ee72a Remove unused BlockNumber type.
If this type was ever used it is not used now.
2025-11-05 23:04:04 +02:00
David Steele 8749601e6d Remove explicit versioning from macros using versioned PostgreSQL types.
Some of these macros have required different implementations according to PostgreSQL version but none of them do now.

The idea of versioning them even when not required was that it would reduce churn but in fact churn is increased because PostgreSQL versions expire far more often than these macros need version specific implementations.
2025-11-05 22:46:54 +02:00
David Steele 00621b6b79 Simplify macros in db/db unit test.
Some of these tests were likely written before the higher-level macros existed. The rest were copied.
2025-11-05 21:46:40 +02:00
David Steele c5657eab23 Fix typo in bundling section of user guide.
repo-bundle-limit controls the size of files included in bundles, not repo-bundle-size, which controls the total size of bundles.
2025-11-05 10:58:16 +02:00
David Steele 5ef282fc22 Improve wording in performance tuning section of user guide. 2025-11-05 10:45:44 +02:00
David Steele 6e9ea92e8a Move release notes to decade directories. 2025-10-21 15:11:28 +02:00
David Steele 713a773232 Begin v2.58.0 development. 2025-10-18 11:18:32 +02:00
David Steele d9773a31c9 v2.57.0: Suppress Repository Symlinks
Bug Fixes:

* Unnest HTTP/TLS/socket timeouts. (Reviewed by David Christensen.)
* Fix possible segfault in page checksum error message. (Fixed by Zsolt Parragi. Reviewed by David Steele.)

Features:

* Add repo-symlink option to suppress creation of repository symlinks. (Reviewed by Douglas J Hunley. Suggested by Ron Johnson.)

Improvements:

* Add HTTP retries for 408 and 429 errors. (Reviewed by David Christensen.)
release/2.57.0
2025-10-18 11:07:36 +02:00
David Steele bfd9790731 Add repo-symlink option to suppress creation of repository symlinks.
Some otherwise Posix-compatible filesystems do not support symlinks. To support this allow symlinks to be disabled.
2025-10-13 11:20:18 +02:00
David Steele 4767f16214 Update release note for PostgreSQL 18 experimental support.
Nothing changed in PostgreSQL before 18.0 so the support is no longer experimental.
2025-10-07 18:36:36 +02:00
David Steele b8ed84f754 Remove no longer used GLUE() macro. 2025-10-05 12:42:42 +02:00
David Steele b4e3d21363 Use FN_NO_RETURN macro consistently in tests.
These cases were either missed in 0dabf88e or added afterwards.
2025-10-05 12:32:06 +02:00
David Steele a451ed22f4 Allow multi-architecture tests to continue if one fails. 2025-10-04 13:49:54 +02:00
David Steele 24802a08b4 Improve support for multi-architecture builds.
On recent versions of Docker it is not necessary to specify the architecture of the require image. The --platform option takes care of it.

Rebuild test images that were modified by this change.
2025-10-04 13:34:53 +02:00
David Steele 96b4b474ce Move aarch64 test to Github Actions.
This test was removed in c64cd8e0 because it was taking too long to be scheduled, which held up testing.

Now that Github Actions supports aarch64 move the test there.
2025-10-04 11:49:38 +02:00
David Steele 5f55f7c1b1 Finalize catalog number for PostgreSQL 18 release. 2025-09-26 11:10:53 +02:00
David Steele c1c40a4a85 Fix possible segfault in backup resume messages.
Similar to adc5e5b23, STRDEF assignment to reason can be out of scope, which may lead to either garbage in the log message or a crash with SIGSEGV.

Fix by using simple char * constants for the reason.
2025-09-26 09:21:50 +02:00
David Steele 76ee6861fb Fix errant STRDEF() in command/backup unit test.
Use strNewZ() so the value persists past the block where it is assigned.
2025-09-16 20:38:02 +02:00
David Steele 5cc9d25817 Remove unused pathSync parameter in SFTP storage driver.
The SFTP storage driver did not set the pathSync method but had logic to see if pathSync was set. This led to some tortured tests since pathSync had to be injected into the interface after the storage object had been created.

Remove the pathSync parameter from storageWriteSftpNew() and also remove related tests.
2025-09-16 14:58:49 +02:00
David Steele 9c7f064864 Unnest HTTP/TLS/socket timeouts.
These timeouts were nested, i.e. an error in the socket connection would also retry in the TLS and HTTP layers. This led to a multiplying effect such that it took nine minutes to fully timeout with the default io-timeout of 60 seconds.

A fix for this was attempted in 5314dbff but it reduced retries by too much and had to be reverted in fa5b2d44.

Instead fix by moving connection attempts to the lower layer (e.g. TLS -> socket) out of the exception block but leave it within the retry loop. So, for example, if the socket connection fails after retries then the error will not be retried by TLS. But if the TLS session fails the socket will be reconnected.
2025-09-05 11:42:00 -04:00
Zsolt Parragi adc5e5b23b Fix possible segfault in page checksum error message.
The STRDEF definition of plural is out of scope in the error message just below it, which may lead to either garbage in the log message or a crash with SIGSEGV.

This is particularly visible with pg_tde, which encrypts tables: if pgbackrest is run with checksum enabled, it tries to emit this message for all encrypted files.

Fix by using simple char * constants in the error message.
2025-08-25 11:51:54 -04:00
David Steele 779cb763af Fix comment typo. 2025-08-23 14:23:30 -04:00
David Steele 5de5ed842a New CI container build for PostgreSQL 18 beta3.
Rebuild all containers to get the most recent versions of PostgreSQL.

Update the Debian repository install to match current recommendations. This has already been done for the documentation in fcd00a45.
2025-08-23 11:40:34 -04:00
David Steele 87339004e5 Add HTTP retries for 408 and 429 errors.
HTTP client errors 408 and 429 were not being retried but there seems to be some benefit to doing so.

408 has only been seen once and in that case the server was returning 400 (with Request Timeout in the response body) but it seems worth doing since this could happen during times of high congestion. Requests are not sent until request content is ready so there is not much else to be done to handle this error.

429 has been seen occasionally in the past but now seems to be common on Cloudflare R2. Ideally we would have a large initial back off here but it is not clear that is worth it at this time. The existing Fibonacci back off should be enough to allow operations to proceed if possible during the configured timeout.
2025-08-13 10:12:29 -04:00
David Steele fcd00a45f5 Update user guide and tests to Ubuntu 22.04.
20.04 is EOL so update the user guide and tests to 22.04.

The contributing guide was updated to 22.04 in d55836e7e.
2025-08-04 17:42:16 -04:00
David Steele 03cabe2644 Begin v2.57.0 development. 2025-07-21 13:08:40 -04:00
David Steele eca9290a2a v2.56.0: Progress Info Improvements
Bug Fixes:

* Fix issue with adhoc expiration when no backups in a repository. (Reviewed by Stefan Fercot. Reported by Anup Gupta.)

Features:

* Add restore progress to info command output. (Contributed by Denis Garsh, Maxim Michkov. Reviewed by David Steele.)
* Add progress-only detail level for info command output. (Contributed by Denis Garsh. Reviewed by David Steele, Stefan Fercot.)

Improvements:

* Retry failed reads on object stores. (Reviewed by David Christensen.)
* Fix defaults in command-line help. (Reviewed by David Christensen, Chris Bandy.)

Documentation Improvements:

* Describe discrete option values in a list where appropriate. (Contributed by Anton Kurochkin. Reviewed by David Steele.)
* Fix "less than" in help output for archive-mode option. (Contributed by Anton Kurochkin. Reviewed by David Steele.)
release/2.56.0
2025-07-21 10:12:22 -04:00
David Steele a2a246bba9 New CI container build for PostgreSQL 18 beta2. 2025-07-18 11:42:12 -04:00
Denis Garsh 8cdd9ce1c4 Add restore progress to info command output.
The prior implementation of the restore command did not provide any progress information. Implement it similarly to the backup command and also update the info command to display restore progress alongside backup progress.

Restore is a read operation and should not block other commands. The only exception is that multiple restores with the same lock and repository path are not allowed, as each restore must write progress to a separate file. Therefore, no lock is needed for restores with a remote role and the restore command should not be terminated when the stop command is executed.
2025-07-16 12:49:34 -04:00
David Steele d55836e7e8 Update contributing guide to Ubuntu 22.04.
20.04 is EOL and Docker is now noisy during installation so update.
2025-07-15 09:45:36 -04:00
David Steele ff944585ca Add funding information. 2025-07-07 16:57:08 -04:00
Denis Garsh 2706168f60 Add progress-only detail level for info command output.
The info command fetches a lot of information from the repository about backups and archives, so this operation can be slow. Because progress data is stored in local lock files, accessing the repository is unnecessary when only progress information is required.

This patch introduces the `--detail-level=[progress|full]` option, with `full` as the default. The `progress` level limits the info command output to progress details without querying the repository. The only remaining operations are scanning the folder structure to list available stanzas and reading lock files.

Note: When `progress` is selected, the info command performs no checks beyond verifying stanza availability.
2025-06-26 17:40:05 -04:00
David Steele 277b4db46f Move variable to scope where it is used. 2025-06-26 08:04:33 -04:00
David Steele 638815b4cd Fix issue with adhoc expiration when no backups in a repository.
If there are no backups in one or more repositories then the following error occurs during adhoc expiration:

ASSERT: [025]: cannot get index 0 from list with 0 value(s)

Fix this by skipping the adhoc logic when there are no backups in a repository.
2025-06-24 12:35:18 -04:00
David Steele 3780057866 Update Fedora test image to Fedora 42. 2025-06-22 17:46:54 -04:00
David Steele d0072945fa Add VR_NON_STRING macro for nonstring attribute.
The nonstring variable attribute specifies that an object or member declaration with type array of char, signed char, or unsigned char, or pointer to such a type is intended to store character arrays that do not necessarily contain a terminating NUL.

Newer versions of gcc will warn if this attribute is missing.
2025-06-22 15:38:32 -04:00
David Steele 44e3ee33d2 Improve defaults and allow lists with option value dependencies.
Some defaults and allow lists were determined in cfgLoadUpdateOption() because they depended on the values of other options, .e.g. compress-level.

Instead build this functionality into the config parser. Not only does this standardize the defaults and allow lists but it makes it possible to automate the documentation, which is also done in this commit.
2025-06-16 17:21:33 -04:00
David Steele 435f8a3ad7 Remove cfgParseOptionDefault() and cfgParseOptionRequired().
It is currently not possible to determine the default of all options knowing just the command. Some defaults are set in cfgLoadUpdateOption() and in an upcoming commit defaults may be based on the value of other options.

It would be possible to update parser to provide this information but that will complicate the parser and since the logic is only used to simplify options passed to remotes it does not seem worth the effort.

For the same reason cfgParseOptionRequired() can also be removed.
2025-06-16 17:05:35 -04:00