1
0
mirror of https://github.com/pgbackrest/pgbackrest.git synced 2025-04-18 21:24:08 +03:00

4640 Commits

Author SHA1 Message Date
David Steele
c2f64bb03b Fix highlight error in user guide.
87776bc9 updated the RHEL documentation to PostgreSQL 13/14 but did not update recovery highlighting to be compatible with RHEL. This was not caught because the RHEL documentation was being build as PDF, which does not do highlighting.

Instead build the RHEL documentation as HTML in the first stage (and PDF in the second) so the error is caught.

Finally, fix the RHEL documentation to generate the highlight by concatenating the log.
2025-04-15 16:50:40 -05:00
David Steele
8bdba74798
Clarify incremental backup expiration.
The documentation was a bit misleading regarding how incremental backups are expired. Update the misleading part ("Differential and Incremental backups are count-based...") and move the explanation of how incremental expiration works out of differential expiration into the introductory paragraph.

Also add a note about how full backups are considered as differential for the purpose of expiration.
2025-04-14 13:34:35 -05:00
David Steele
565d2e0c47
PostgreSQL 18 experimental support.
Support is experimental since PostgreSQL 18 is still in development and has not released a beta, but it may be useful for testing.
2025-04-14 12:29:31 -05:00
David Steele
019e4cf8a7 Another fix for integration tests on alternate architectures.
37544da5 missed another place where 57ffd2df had accidentally hard-coded the integration test architecture to x86_64.

Fix the test code to use the correct image based on architecture.
2025-04-14 10:46:55 -05:00
David Steele
48a43e76e2 Enable format-overflow=2 compiler warning.
Warn about calls to formatted input/output functions such as sprintf and vsprintf that might overflow the destination buffer.

This warning found a few short float buffers. In practice these are unlikely to ever be a problem based on our float usage but best to be safe.

Note that this warning only requires the buffer size to be 317 but it must be 318 to prevent warnings from -Wformat-truncation=2. We are not ready to enable that warning yet but seems better to get the buffer correct now.
2025-04-11 18:39:56 -05:00
David Steele
5fe23ff07b Remove implied -Wformat-nonliteral warning.
-Wformat-nonliteral is already implied by -format=2.
2025-04-11 17:02:14 -05:00
David Steele
9fba07c26d Remove -Wno-implicit-fallthrough and explicitly mark fallthrough.
Last time we tried this the markered seems a bit unreliable but __attribute__((fallthrough)) appears to work pretty well.
2025-04-11 16:52:45 -05:00
David Steele
a076ee63bd Remove unmaintained/unused development environment build files.
The Vagrantfile has not been maintained in years and the Dockerfile is only used by a single developer. There are instructions for building a development environment in CONTRIBUTING.md so these build files are no longer required.
2025-04-10 15:29:37 -05:00
David Steele
dd3a7d99a7
Recommend not placing spool-path within pg_xlog/pg_wal.
This is generally not a good idea and it can cause problems for PostgreSQL tools such as pg_rewind.
2025-04-10 12:08:35 -05:00
David Steele
cab4d6fd5c
Warn when a value for a multi-key option is overwritten.
Some options can contain multiple key/value pairs. However, if if the key is specified again the value will be silently overwritten. In most cases one value per key is appropriate, but it makes sense to warn the user about the overwrite.
2025-04-10 10:26:50 -05:00
David Steele
68f22aea66
Allow connections to PostgreSQL on abstract domain sockets.
Currently the pg-socket-path option is required to be a valid absolute path but this precludes the use of abstract domain sockets.

Set the option type to string so abstract domain sockets are allowed. This removes some validation but libpq will report if the path is invalid and we don't use it for any other purpose.
2025-04-09 14:50:16 -05:00
David Steele
20bfd14b73
Calculate content-md5 on S3 only when required.
The content-md5 header was generated for all requests with content but it is only required for batch delete requests. It is not clear why this header is required when x-amz-content-sha256 is also provided or why it
is required only for this request but the documentation is clear on the matter. However, the content for these requests is relatively small compared to uploading files so omitting content-md5 where possible will
save some CPU cycles.

Current AWS S3 and recent Minio don't complain if this header is missing but since it is still required by older versions of Minio and it is specified in the documentation for batch delete it is makes sense to
keep it.
2025-04-09 12:27:27 -05:00
David Steele
c925832e17 Add LSTDEF() macro.
This macro allows static List objects to be created which simplifies usage when passing lists to functions. Also, since List objects are commonly used this makes the code base a bit more consistent.

For now skip static lists that are only used locally within a function since the benefit is not as clear.
2025-04-09 12:02:19 -05:00
David Steele
53a45d25c3
Fix documentation for specifying multiple stanzas with tls-server-auth.
The prior documentation said that multiple stanzas should be specified by repeating the tls-server-auth option. This is incorrect -- in fact a comma-separated list of stanza should be used.

Fix the documentation and add a test to confirm this behavior.

In passing add some const qualifiers that were missing in the relevant code.
2025-04-08 10:45:06 -05:00
David Steele
37544da56c Fix integration tests on alternate architectures.
57ffd2df accidentally hard-coded the integration test architecture to x86_64 and it was not noticed because in CI all the integration tests run on that architecture.

Fix the test code to retrieve the current architecture and use it for integration tests.
2025-04-07 11:57:00 -05:00
Yegor
e18ca19895
Remove extraneous const from cvtIntToZ() prototype. 2025-04-04 10:26:03 -05:00
Yegor
aeea81a388
Fix test logging in storageHelperDryRunInit(). 2025-04-04 10:07:32 -05:00
David Steele
cc50e1aecd
Revert "full/incremental backup method".
This method was introduced in cad595f but on further reflection it does not seem worth the added complexity just to make restore consistency faster without improving the speed of the overall backup. The most common recovery case is PITR and this method produces diminishing returns as the recovery time gets further from the backup end time.

A better solution (not implemented here) is to copy unmodified files from prior backups. This is much faster than recopying and compressing files from the cluster (especially on object stores with a copy command) and can even be done after the backup window to further reduce WAL replay required for consistency. It also reduces load on the host where the backup is made.
2025-04-02 15:25:23 -05:00
David Steele
4a42eec552 Set noResetLogLevel in config/parse unit tests where required.
This prevents the logging from getting reset so later tests can validate warnings.
2025-04-02 11:59:38 -05:00
David Steele
33655095f4 Use latest Minio image for testing.
It has been a while since a Minio bug has broken the tests so go back to testing against the latest version until the trust is broken again.
2025-03-31 19:30:41 -05:00
albertchae
dcfe30e322
Fix instances of "of of". 2025-03-31 14:18:29 -05:00
David Steele
b28ae98cec Update unix_socket_directory to unix_socket_directories.
unix_socket_directory has not been valid since PostgreSQL 9.2 and since 9.5 is now the minimum supported version there is no reason to document both.
2025-03-31 12:24:03 -05:00
Maxim Michkov
e4def8845e
Allow verification of a specified backup.
Add support for the verify command --set option. This (internal) option was already accepted without errors but was not implemented.

The default behavior for verify is to check all the backups present. With the --set option only the specified backup will be verified. If the specified backup label is not valid an error is added to the result and verification is skipped. In addition, only WAL required to make the specified backup consistent will be verified.
2025-03-26 08:44:29 -06:00
David Steele
945c7d1eb6 Update verify command summary.
The prior text implied that verify could only operate on a single repository. Make the summary more general to indicate that the command can work on any repository.
2025-03-25 12:43:32 -06:00
David Steele
1cfafa386c Strip version from RHEL label in user guide.
RHEL 7 is EOL so remove it from the label. Rather than update the version range just remove it from the label since the user guide is generally applicable to RHEL.
2025-03-25 11:00:53 -06:00
David Steele
87776bc9cf Update PostgresQL versions in user guide.
PostgreSQL 12 is EOL and no longer available in the yum.postgresql.org repository.

Update the base and update versions of the RHEL and Debian documentation to better cover supported versions.
2025-03-25 10:28:46 -06:00
David Steele
84eb9a742d
Clarify behavior of --repo-retention-full-type.
Make some clarifications and add explicit documentation for repo-retention-full-type=count.
2025-03-24 12:21:31 -06:00
David Steele
5d2c67c3c6
Fix block incremental restore issue on non-default repository.
If the selected backup to restore was not in the default (lowest number) repository and block incremental was used, then restore would erroneously try to load the file super block list from the default repository. Specifying --repo would fix this since it changed the default repository.

Fix by updating the super block read to the specified repository.
2025-03-21 10:37:20 -06:00
Yegor
723f900eaa
Fix missing return in FUNCTION_LOG_RETURN_VOID().
This macro is only ever called last in functions so this is not an active issue, but it makes sense to fix since it would pose a risk for future development.
2025-03-21 09:01:02 -06:00
Yegor
d10ad3780a
Fix test logging. 2025-03-19 11:17:59 -06:00
Yegor
f00c0d4e85
Fix comments in unit tests. 2025-03-19 09:34:32 -06:00
Stefan Fercot
750a051b7a
Add numeric output to version command.
Add a new output option to the version command that defaults to text (current behavior) but can be set to num to output the version in a numeric format, e.g. 2055000.

This makes it easier to compare and identify versions of pgBackRest.
2025-02-28 16:53:03 -06:00
David Steele
57ffd2dfcb Fix multi-architecture unit testing.
The Github action we were using for multi-architecture testing stopped working. The project does not seem to be getting regular maintenance so it seems better to roll multi-architecture testing into our existing container builds.

Introduce multi-architecture builds and testing into our test framework. For now this only works for unit tests -- integration tests will still only run on x86_64. That could be updated in the future but since emulation is so slow it is not clear if it would be useful.

Also fix an invalid 32-bit checksum. The d11 test had not been running as 32-bit since d8ff89a so the checksum was not updated when it should have been in 48f511d.
2025-02-28 15:38:05 -06:00
Timothée Peignier
814bf487c3
Add support for GCS requester pays.
GCS user projects allow the bucket requester to be billed rather than the bucket owner. This is useful for hosted services that create backups and want to provide direct (probably read-only) access to the backups.
2025-02-25 16:37:22 -06:00
Timothée Peignier
4db0263fd6
Add support for S3 requester pays.
S3 requester pays allows the bucket requester to be billed rather than the bucket owner. This is useful for hosted services that create backups and want to provide direct (probably read-only) access to the backups.
2025-02-25 16:12:28 -06:00
David Steele
7941d6506e Remove unneeded verbiage from option descriptions.
"Setting this option" didn't really add anything and was inconsistent with other option descriptions.
2025-02-25 15:36:55 -06:00
David Steele
f2bbfad29c Fix case in option summary. 2025-02-21 08:24:57 -06:00
Stefan Fercot
2155a12a3d
Add detail logging for expired archive path.
When archive expiration has a large number of files to remove it may look like the process has hung, at least at higher log levels.

Add a log message at detail level to show that progress is being made.
2025-02-17 11:51:51 -06:00
Stefan Fercot
4dcfa9ef59 Add detail logging to expire test.
This is required to test logging to be added in a subsequent commit.
2025-02-17 10:56:57 -06:00
Greg Clough
82299eb4cd
Clarify requirement for local/remote pgBackRest versions to match. 2025-02-15 12:00:00 -06:00
David Steele
47f050f8fd
Fix expire archive range logging.
The prior logging only output the last path to be removed since start was overwritten as each path was deleted. This had no affect on expire functionality but was confusing since many more files might be expired than the logs indicated.

Fix logging so the correct start path is logged.
2025-02-15 11:17:04 -06:00
David Steele
ef0a71d629 Update Cirrus-CI FreeBSD runner versions. 2025-02-15 11:02:23 -06:00
David Steele
aa7210a183 Change --process-max recommendation for object stores to --repo-bundle.
While process-max is as useful for object stores as any other storage type, for file creation time in particular file bundling is far more effective since fewer files are created.

Update the recommendation to reflect this.
2025-02-04 11:15:51 -05:00
David Steele
922e9f0775 Verify recovery target timeline.
If the user picks an invalid timeline (or the default is invalid) they will not discover it until after the restore is complete and recovery starts. In that case they'll receive a message like this:

FATAL:  requested timeline 2 is not a child of this server's history
DETAIL:  Latest checkpoint is at 0/7000028 on timeline 1, but in the history of the requested timeline, the server forked off from that timeline at 0/600AA20.

This message generally causes confusion unless one is familiar with it. In this case 1) a standby was promoted creating a new timeline 2) a new backup was made from the primary 3) the new backup was restored but could not follow the new timeline because the backup was made after the new timeline forked off. Since PostgreSQL 12 following the latest timeline has been the default so this error has become common in split brain situations.

Improve pgBackRest to read the history files and provide better error messages. Now this error is thrown before the restore starts:

ERROR: [058]: target timeline 2 forked from backup timeline 1 at 0/600aa20 which is before backup lsn of 0/7000028
       HINT: was the target timeline created by accidentally promoting a standby?
       HINT: was the target timeline created by testing a restore without --archive-mode=off?
       HINT: was the backup made after the target timeline was created?

This saves time since it happens before the restore and gives more information about what has gone wrong.

If the backup timeline is not an ancestor of the target timeline the error message is:

ERROR: [058]: backup timeline 6, lsn 0/4ffffff is not in the history of target timeline B
       HINT: was the target timeline created by promoting from a timeline < latest?

This situation should be rare but can happen during complex recovery scenarios where the user is explicitly setting the target time.
2025-02-04 10:06:17 -05:00
David Steele
322e764f29 Add Coverity build to release instructions. 2025-01-30 21:43:48 -05:00
David Steele
6e437defa9 Refactor backupBlockIncrMapSize() range handling to satisfy Coverity.
Coverity complained about a possible overflow of result in the prior implementation.

It appears that Coverity was not able to follow the logic through the try block, but refactor and add an assertion to silence the complaint.
2025-01-30 14:28:28 -05:00
David Steele
89615eee65 Refactor loop in restoreManifestMap() to satisfy Coverity.
Coverity complained that decrementing targetIdx would result in it equaling UINT_MAX. While this is true it had no impact overall (at it least in the current code) since targetIdx was immediately incremented in the loop.

However, Coverity's suggestion is better and safer for future code updates so it makes sense to change it.
2025-01-30 13:59:42 -05:00
David Steele
5421ef3e92 Add cast to suppress Coverity complaint about volatile used in assert().
Coverity had this complaint:

assert_side_effect: Argument openData of ASSERT() has a side effect because the variable is volatile. The containing function might work differently in a non-debug build.

It appears this can also be fixed by assigning the volatile variable to an automatic but the cast seems to work just as well.
2025-01-30 13:48:59 -05:00
David Steele
d5cefb7290
Fix error reporting for queries with no results.
If a query that expected no results returned an error then it would incorrectly report that no results were expected because the error was interpreted as a result.

Switch the order of the checks so that an error is reported instead and add a test to prevent regression.
2025-01-29 13:48:26 -05:00
David Steele
d50b01b485 Add assertions to satisfy Coverity about possible underflows.
Coverity complained about possible underflows so add assertions to demonstrate that the values in question are greater than zero.
2025-01-28 18:48:11 -05:00