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

4559 Commits

Author SHA1 Message Date
David Steele
0e143ba7e7 Remove --min-gen option from test.pl.
This option was useful for the Perl code generation and autoconf generation, which were both slow. These are both gone now and the C code generation is fast enough that there is no need to exclude it.

--dry-run will still prevent certain code generation from running. This may not be necessary any more but removing it should be the subject of a separate commit.
2024-11-27 17:05:31 -05:00
David Steele
cad595f9f8
Full/incremental backup method.
This backup method does a preliminary copy of all files that were last modified prior to a defined interval before calling pg_backup_start(). Then the backup is started as usual and the remainder of the files are copied. The advantage is that generally a smaller set of WAL will be required to make the backup consistent, provided there are some files that have not been recently modified.

The length of the prior full backup is used to determine the interval used for the preliminary copy since any files modified within this interval will likely be modified again during the backup. If no prior full backup exists then the interval is set to one day.

This feature is being committed as internal-only for the time being.
2024-11-26 11:23:43 -05:00
David Steele
0577b03016
Use lz4 for protocol compression.
lz4 provides much better compression speed and gives similar compression ratios to gz when used at low levels (the gz default was 3).
2024-11-26 11:03:27 -05:00
David Steele
4af42d93b2 Update release notes for PostgreSQL 17 support.
Accurately reflect when different versions of PostgreSQL were supported since an update was required for beta3.
2024-11-25 10:38:37 -05:00
Kian-Meng Ang
c351263a1d
Fix typos.
Found using `codespell -S *.eps,*.cache,*.xml -L inout,te,fo,bload,fase,collet,hilight,debians,keep-alives` and `typos --hidden --format brief`.
2024-11-22 15:25:43 -05:00
David Steele
7f2dfc021c Update Fedora test image to Fedora 41. 2024-11-18 13:33:03 -05:00
David Steele
33d7681347 Enable missing-variable-declarations compiler warning.
Warn if a global variable is defined without a previous declaration. Use this option to detect global variables that do not have a matching extern declaration in a header file.
2024-11-18 10:58:00 -05:00
David Steele
4ae160aa34 Add wait for async archive log exists check in integration test.
They may be a small delay before the log exists, especially on slower platforms. Add a wait so the test does not fail in this case.
2024-11-15 09:44:15 -05:00
David Steele
12fe139315 Allow negative values for integer options.
This mostly worked but there was a rendering issue that prevented compilation.
2024-11-13 17:48:14 -05:00
David Steele
d7c2d2ba1b Move compression driver param list management to a common module.
This code was duplicated in each driver so this means less duplication.

In addition, some drivers were not creating a parameter list for decompression which meant they could not be used remotely. This is not a currently a bug since none of them were being used remotely, but it was a blocker for using lz4 for protocol compression.
2024-11-13 17:28:21 -05:00
Viktor Kurilko
274bb24a5a
Stabilize async archiving in integration tests.
The integration tests could fail if:

1. After restoring the PostgreSQL instance the recovery process starts, which calls asynchronous archive-get.
2. After archive-get checks the existence of the queue directory, but before writing the WAL file, there are restores when the next test is begun, which leads to the deletion of the queue directory.
3. Since the directory no longer exists, writing the WAL file will fail, and archive-get will write the error file to the queue.
4. A new PostgreSQL instance will start and the recovery process will begin, which requests the WAL file.
5. The new archive-get looks into the queue directory, finds the error file, and throws out the error, after which the PostgreSQL recovery fails because the previous archive-get background process has not finished yet.

This patch fixes the problem by using a separate spool directory for each test.
2024-11-13 09:56:42 -05:00
David Steele
db912c049c Exclude function void return logging macros from coverage reporting.
An in 355e27d6, it makes sense to exclude FUNCTION_(LOG|TEST)_RETURN_VOID() macros when then they are on the last line of a function because in this case they are a noop (but are still used for debugging).
2024-11-08 10:21:25 -05:00
David Steele
c9c73ede9d
Fix issue with version/help commands attempting to load pgbackrest.conf.
8d6bceb5 refactored version/help to operate more like regular commands in part to simplify the implementation of --version and --help. Unfortunately this had the side effect of these commands also loading pgbackrest.conf which would lead to an error if the file could not be read or parsed.

Add a filter to prevent version or help from loading pgbackrest.conf. Also prevent reads from the env to stop any warnings or errors from that source.
2024-11-07 10:30:16 -05:00
David Steele
c678543165 Remove conditional compilation for lz4.
0c32757f made lz4 required in the meson build but conditional compilation was left in to make reverting easy for packagers just in case.

Since a few releases have gone by without any complaints, remove conditional compilation for lz4.
2024-11-07 09:27:02 -05:00
David Steele
355e27d69c Exclude function logging macros from coverage reporting.
It makes sense to exclude these from reporting since they are always covered when the function is covered and they are purely for debugging.
2024-11-02 11:50:30 -04:00
David Steele
fc5fdb8d35 Fix incorrect log macros.
These led to incorrect log output in some cases. Probably not very noticeable, but definitely wrong.

Also fix types in the log macro comments.
2024-11-02 11:36:56 -04:00
David Steele
ed39078068 Enable float-equal and init-self compiler warnings.
No code changes were required to enable these warnings.
2024-10-29 14:15:12 +02:00
David Steele
98670aee89 Enable redundant-decls compiler warning.
Warn if anything is declared more than once in the same scope, even when the extra declaration is valid and changes nothing. This is primarily useful for catching missing header ifdef barriers.

Move the environ variable into config/parse.h since it must be declared by us and we use it multiple times.
2024-10-28 19:13:38 +02:00
David Steele
9ec9b9d120 Enable missing-prototypes compiler warning.
Warn if a global function is defined without a previous prototype declaration. This helps detect when a function that should be static is accidentally declared extern.

Most of the changes are to add missing header files so functions can see their declarations.

In a some cases functions that should have been static were marked as such. There were only five of these in the core but every little bit counts.

Lastly, it was necessary to suppress the warning in the postgres test modules where the function declarations are not available. This is fixable by aligning the module with the auto-generated code in core, but is not a priority.
2024-10-28 17:49:55 +02:00
David Steele
21f7d2d3a8 Enable cast-qual compiler warning.
Warn whenever a pointer is cast so as to remove a type qualifier from the target type. For example, warn if a const char * is cast to an ordinary char *.

Most of the changes for this are fairly rote: just add a const qualifier where needed. In some cases functions needed to be reworked to return non-const where before they had returned const and then cast it back to non-const. None of these patterns appeared to be bugs, but they were certainly misleading.

Some cases (especially excvp() and calls to bz2) could not be fixed because of how functions out of our control are defined. In those cases the warnings have been suppressed and a comment added to detail the exception. This was also done a few places in the tests.
2024-10-28 14:21:38 +02:00
David Steele
bb7e1724a9 Update String, Buffer, and Variant constants to work with cast-qual.
These three objects can be created as constants at compile time using specialized macros. Unfortunately since the values assigned are also const, cast-qual complained about the cost qualifier being lost.

Fix this by creating new structures to be used just for creating these constants. This is not ideal due to the need to keep the duplicated structures in sync, but in practice these structures are almost never modified. Testing should catch any out of sync structures and this feature is valuable enough to keep even though in theory there could be memory safety issues. In practice the APIs prevent const objects from being used in an unsafe way and testing provides a fair assurance of safety. Writing to these consts would be a fatal error even if it did not cause a segfault.

Ideally, we would be able to use warning suppression in these macros to avoid the extra struct, but due to the way they are used it is not possible to add the required pragmas (even using _Pragma).

Finally this construction makes it obvious that something special is being done, rather than it being under the covers.
2024-10-28 13:21:35 +02:00
David Steele
a981ef08d7 Fix misplaced volatile qualifiers in GCS authorization JWT generation.
The volatile qualifiers should be on the pointers that are stored on the stack, not on the structures that are allocated by OpenSSL functions.

Also remove all the casts that were required when volatile was in wrong place.
2024-10-28 13:20:19 +02:00
David Steele
118f93baab Update Cirrus MacOS runner to OpenSSL 3.
OpenSSL 1.1 is no longer available in HomeBrew.
2024-10-28 13:07:35 +02:00
David Steele
48f511dad3
Remove support for PostgreSQL 9.4.
Per our policy to support five EOL versions of PostgreSQL, 9.4 is no longer supported by pgBackRest. Remove all logic associated with 9.4 and update the tests.

This includes a small fix in infoPg.c to allow backup.info files with old versions to be saved. This allows expire to function when old versions are present. Even though those older versions cannot be used, they can be expired.

Tests for 9.4 are left in the expire/info tests to demonstrate that these commands work with old versions present.
2024-10-21 13:56:04 +03:00
David Steele
89c9baba72
Remove autoconf/make build.
2.54.0 is the last release to support the autoconf/make build. Remove the autoconf/make build to reduce maintenance going forward.
2024-10-21 13:32:35 +03:00
David Steele
4125f726a8 Begin v2.55.0 development. 2024-10-21 09:11:49 +03:00
David Steele
1e5f46b7d9 v2.54.0: Target Time for Versioned Storage
NOTE TO PACKAGERS: This is last feature release to support the autoconf/make build. Please migrate to meson if you have not already done so. 2.54.X patch releases (if any) will continue to support autoconf/make.

Bug Fixes:

* Fix PostgreSQL query performance for large datasets. (Fixed by Thibault Vincent, David Steele. Reviewed by David Christensen, Antoine Millet. Reported by Antoine Millet.)

Features:

* Allow repositories on versioned storage to be read at a target time. (Reviewed by Stefan Fercot, David Christensen.)
* Allow requested standby backup to proceed with no standby. (Reviewed by Stefan Fercot.)

Improvements:

* Summarize backup reference list for info command text output. (Contributed by Stefan Fercot. Reviewed by David Steele.)
* Refresh web-id token for each S3 authentication. (Contributed by Brent Graveland. Reviewed by David Steele.)
* Correctly display current values for indexed options in help. (Reviewed by David Christensen.)
* Save backup.info only when contents have changed. (Reviewed by Stefan Fercot.)
* Remove limitation on reading files in parallel during restore. (Reviewed by David Christensen.)
* Improve SFTP error messages. (Contributed by Reid Thompson. Reviewed by David Steele.)

Documentation Features:

* Add performance tuning section to user guide. (Reviewed by Stefan Fercot.)

Documentation Improvements:

* Clarify source for data_directory. (Contributed by Stefan Fercot. Reviewed by David Steele. Suggested by Matthias.)
* Better logic for deciding when a summary should be lower-cased. (Suggested by Daniel Westermann.)
2024-10-21 08:57:43 +03:00
David Steele
7effca0d09 Update CI tests for ppc64le/s390x architectures.
The action suddenly broken and this appears to be the best work around according to https://github.com/uraimo/run-on-arch-action/issues/155.

Unfortunately the tests take almost twice and long to run, probably because the container needs to be built from scratch.
2024-10-20 20:28:54 +03:00
Stefan Fercot
9ba2db0173
Clarify source for data_directory. 2024-10-16 12:41:26 +03:00
David Steele
f76da03eb6 Update CI containers to include newest PostgreSQL patch releases. 2024-10-16 12:14:12 +03:00
David Steele
bd0480ca7d Move SFTP test off of PostgreSQL version tested by 32-bit.
There have been occasional SFTP authentication failures on 32-bit. We are planning to drop 32-bit support so it does not seem worth chasing these errors down and they are likely timing issues anyway.
2024-10-16 11:07:21 +03:00
David Steele
65dfe2407d Retry socket bind.
In the case of a rapid restart it is possible that the socket may not be immediately available, so retry until it becomes available.

This is particularly useful for testing where sockets are bound and released very rapidly.
2024-10-12 10:06:40 +03:00
David Steele
ed72c6f9a1 Render command help summaries the same as option help summaries.
Option help summaries do not have initial capitals (except in special cases) and final periods so it makes sense to render the command summaries the same way.

Use the same function for both so they are consistent.
2024-10-11 12:05:23 +03:00
David Steele
eb2f279a29 Better logic for deciding when a summary should be lower-cased.
The old logic would lower-case PostgreSQL which looked odd. This should be more robust for anything that looks like a proper name of acronym.
2024-10-11 11:53:34 +03:00
Reid Thompson
70bda2cfb2
Improve SFTP error messages.
The numbers by themselves weren't very informative and required looking into the libssh2_sftp.h header file for the definition.
2024-10-10 11:17:35 +03:00
Thibault VINCENT
c8ccaaa755
Fix PostgreSQL query performance for large datasets.
The asynchronous logic used to implement the query timeout was misusing PQisBusy(), which caused the wait handler to throttle the consumption of command results. It could introduce a large delay on a query up to `db-timeout` because of the back-off sequence.

Following the recommendation of libpq, fix by polling the client socket for data availability and then continue consuming results and checking for command busyness.
2024-10-10 09:48:43 +03:00
David Steele
33fa396561 Refactor Wait object to expose remaining wait as waitRemains().
This is useful for code that has its own wait mechanism, e.g. poll(), but still needs a way to track overall time elapsed.

To keep it simple waitRemains() is called by waitMore().
2024-10-09 17:57:52 +03:00
David Steele
77ae753ef5 Allow fdReady() shim to be run only once with a specified return value.
This allows more targeted testing than the prior (still supported) approach.
2024-10-09 17:48:00 +03:00
David Steele
6ac4e8dd78 Move fd module shim to io module test.
The shim is needed in an earlier test and this is a more logical place for it anyway.
2024-10-09 10:46:45 +03:00
David Steele
1020bc117a Shuffle PostgreSQL versions between test containers.
Ubuntu 20.04 has been having consistent errors starting PostgreSQL 10 so move 9.5 to this container instead. An older version makes sense with an older distro.

Also move PostgreSQL 12 from RHEL 8 since this version will be EOL soon.
2024-10-08 18:15:34 +03:00
David Steele
b50ad48fd4 Use systemctl replacement to generate documentation.
Containers are notoriously unfriendly to systemctl (really systemd) but we prefer to use systemctl to make our documentation as accurate as possible. This replacement performs all the functions of systemctl without requiring systemd, which great simplifies container configuration and allows the documentation build to work in more environments.
2024-10-08 11:01:55 +03:00
David Steele
1ebdcd611d Use output path for temp config files during documentation build.
Putting the files in the user's home directory was too Linux-centric.
2024-10-08 10:28:01 +03:00
David Steele
b3ca2e3482
Correctly display current values for indexed options in help.
The current value for an indexed option was always for the first index, e.g. pg1-path. This is likely legacy from before indexing was added (and faithfully copied over from Perl, apparently).

Fix this by enumerating the current values in the option help and displaying <multi> in the option list when more than one value exists.
2024-10-05 09:41:50 +03:00
David Steele
047e3d0ed9 Finalize catalog number for PostgreSQL 17 release. 2024-10-02 19:49:15 +03:00
David Steele
9f97269678 Use uname -m to get architecture for RHEL package in user guide. 2024-10-02 18:02:15 +03:00
David Steele
d4ed1884ea Reduce logging for help functions.
Full debug/trace logging in production is unlikely to be useful but does use space in the binary.

Reduce logging to be useful for testing but not be deployed in production.
2024-09-24 12:33:19 +03:00
David Steele
cd7711f5e6 Update Cirrus CI MacOS running to Sonoma. 2024-09-20 15:58:18 +03:00
David Steele
278319eba3
Add performance tuning section to user guide.
We frequently tell users to enable to these options but they are spread through the documentation and not at all obvious. Hopefully putting them in the quick start will make them more visible and also provide an easy place to link.
2024-09-20 15:49:26 +03:00
David Steele
f73c638275 Skip command-line options in configuration reference.
Options that are only valid on the command-line should not appear in the configuration reference because it implies that they can be added to pgbackrest.conf, which is not the case.

Most command-line options were already excluded because they lacked a section, but a few were slipping through.
2024-09-20 15:21:38 +03:00
David Steele
b19134dccd
Allow repositories on versioned storage to be read at a target time.
This feature allows the archive-get, info, repo-get, repo-ls, restore, and verify commands to operate at a point-in-time on versioned buckets in Azure, GCS, and S3. This allows recovery even if a repository has been accidentally or maliciously deleted or corrupted.
2024-09-17 10:51:21 +03:00