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

2103 Commits

Author SHA1 Message Date
David Steele
30f55a3c2a Add compressed storage feature.
This feature denotes storage that can compress files so that they take up less space than what was written.  Currently this includes the Posix and CIFS drivers.  The stored size of the file will be rechecked after write to determine if the reported size is different.  This check would be wasted on object stores such as S3, and they might not report the file as existing immediately after write.

Also add tests to each storage driver to check features.
2019-07-15 17:36:24 -04:00
David Steele
3e1062825d Allow multiple filters to be pushed to the remote and return results.
Previously only a single filter could be pushed to the remote since order was not being maintained.  Now the filters are strictly ordered.

Results are returned from the remote and set in the local IoFilterGroup so they can be retrieved.

Expand remote filter support to include all filters.
2019-07-15 16:49:46 -04:00
David Steele
d5654375a5 Add ioReadDrain().
Read all data from an IoRead object and discard it.  This is handy for calculating size, hash, etc. when the output is not needed.

Update code where a loop was used before.
2019-07-15 08:44:41 -04:00
Cynthia Shang
cdb75ac8b3 Add constants for path and archive.info/backup.info combinations.
Contributed by Cynthia Shang.
2019-07-15 07:13:36 -04:00
David Steele
ede7df9fb1 Allow NULL in JSON list. 2019-07-14 15:53:31 -04:00
David Steele
c836c483dc Add lstClear() to List object. 2019-07-14 15:42:55 -04:00
David Steele
e10577d0b0 Fix incorrect offline upper bound for ignoring page checksum errors.
For offline backups the upper bound was being set to 0x0000FFFF0000FFFF rather than UINT64_MAX.  This meant that page checksum errors might be ignored for databases with a lot of past WAL in offline mode.

Online mode is not affected since the upper bound is retrieved from pg_start_backup().
2019-07-11 09:13:56 -04:00
David Steele
2fd0ebb78a Fix links broken by non-standard version.
Using version 2.15.1 fixed the duplicate tarball problem but broke the auto-generated links.  Fix them manually since this should not be a common problem.

Reported by Mohamad El-Rifai.
2019-07-10 15:08:35 -04:00
Cynthia Shang
6a89c1526e Revert a2dcdc07.
It is simpler to implement the required logic in stanza-delete rather than add complexity to this function.

Contributed by Cynthia Shang.
2019-07-10 12:04:25 -04:00
David Steele
04646599a7 Remove extraneous test macro. 2019-07-10 06:17:33 -04:00
David Steele
4e7db608dc Clarify that return statements are not removed in production builds. 2019-07-10 06:11:21 -04:00
David Steele
a22a6dc08c Update contributor name. 2019-07-10 06:06:07 -04:00
Cynthia Shang
a2dcdc0711 Update lockStopTest() to optionally return a result rather than error.
Some commands (e.g. stanza-delete) would prefer to throw a customized error.

Contributed by Cynthia Shang.
2019-07-09 16:41:58 -04:00
David Steele
27b3246e85 Exclude more build files from rsync between tests.
Files (especially build.auto.h) were being removed and forcing a full build between separate invocations of test.pl.

This affected ad-hoc testing at the command-line, not a full test run in CI.
2019-07-08 08:29:25 -04:00
David Steele
5e1ed2e8a5 Remove clang static analysis.
This analysis never produced anything but false positives (var might be NULL) but took over a minute per test run and added 600MB to the test container.
2019-07-05 18:34:15 -04:00
David Steele
488fb67294 Force PostgreSQL versions to string for newer versions of JSON:PP.
Since 2.91 JSON::PP has a bias for saving variables that look like numbers as numbers even if they were declared as strings.

Force versions to strings where needed by appending ''.

Update the json-pp-perl package on Ubuntu 18.04 to 2.97 to provide test coverage.
2019-07-05 17:25:01 -04:00
David Steele
9836578520 Remove perl critic and coverage.
No new Perl code is being developed, so these tools are just taking up time and making migrations to newer platforms harder.  There are only a few Perl tests remaining with full coverage so the coverage tool does not warn of loss of coverage in most cases.

Remove both tools and associated libraries.
2019-07-05 16:55:17 -04:00
David Steele
fc21013522 Fix scoping violations exposed by optimizations in gcc 9.
gcc < 9 makes all compound literals function scope, even though the C spec requires them to be invalid outside the current scope.  Since the compiler and valgrind were not enforcing this we had a few violations which caused problems in gcc >= 9.

Even though we are not quite ready to support gcc 9 officially, fix the scoping violations that currently exist in the codebase.

Reported by chrlange, Ned T. Crigler.
2019-07-05 16:25:28 -04:00
David Steele
1708f1d151 Use minio for integration testing.
ScalityS3 has not received any maintenance in years and is slow to start which is bad for testing.  Replace it with minio which starts quickly and ships as a single executable or a tiny container.

Minio has stricter limits on allowable characters but should still provide enough coverage to show that our encoding is working correctly.

This commit also includes the upgrade to openssl 1.1.1 in the Ubuntu 18.04 container.
2019-07-02 22:20:35 -04:00
David Steele
b9b21315ea Updates for openssl 1.1.1.
Some HTTP error tests were failing after the upgrade to openssl 1.1.1, though the rest of the unit and integration tests worked fine.  This seemed to be related to the very small messages used in the error testing, but it pointed to an issue with the code not being fully compliant, made worse by auto-retry being enabled by default.

Disable auto-retry and implement better error handling to bring the code in line with openssl recommendations.

There's no evidence this is a problem in the field, but having all the tests pass seems like a good idea and the new code is certainly more robust.

Coverage will be complete in the next commit when openssl 1.1.1 is introduced.
2019-07-02 22:09:12 -04:00
David Steele
c55009d0f9 Community yum package can be installed with --var=package=yum.
Like apt, the community yum package can now be installed instead of a user-specified package.
2019-06-27 14:39:11 -04:00
David Steele
b0728c33db Remove Debian package patch merged to upstream. 2019-06-27 14:30:20 -04:00
David Steele
020101b30b Update release notes to explicitly select release commit when tagging. 2019-06-27 09:38:40 -04:00
Cynthia Shang
33e3d316d6 Reverse loop in infoPgSave() to be consistent with infoPgNewLoad().
Contributed by Cynthia Shang.
2019-06-26 19:52:04 -04:00
David Steele
4bffa0c5bb Add test function to create the S3 bucket instead of using aws cli.
Eventually the idea is to remove the dependency on aws cli since Python is a big install.
2019-06-26 15:02:30 -04:00
David Steele
4815752ccc Add Perl interface to C storage layer.
Maintaining the storage layer/drivers in two languages is burdensome.  Since the integration tests require the Perl storage layer/drivers we'll need them even after the core code is migrated to C.  Create an interface layer so the Perl code can be removed and new storage drivers/features introduced without adding Perl equivalents.

The goal is to move the integration tests to C so this interface will eventually be removed.  That being the case, the interface was designed for maximum compatibility to ease the transition.  The result looks a bit hacky but we'll improve it as needed until it can be retired.
2019-06-26 08:24:58 -04:00
David Steele
bd6c0941e9 Fix missing dash in site name.
Without this the project name and tagline just run together.
2019-06-25 17:27:19 -04:00
David Steele
466602387b Begin v2.16 development. 2019-06-25 08:42:20 -04:00
David Steele
6650d8144c v2.15: C Implementation of Expire
Bug Fixes:

* Fix archive retention expiring too aggressively. (Fixed by Cynthia Shang. Reported by Mohamad El-Rifai.)

Improvements:

* The expire command is implemented entirely in C. (Contributed by Cynthia Shang.)
* The local command for restore is implemented entirely in C.
* Remove hard-coded PostgreSQL user so $PGUSER works. (Suggested by Julian Zhang, Janis Puris.)
* Honor configure --prefix option. (Suggested by Daniel Westermann.)
* Rename repo-s3-verify-ssl option to repo-s3-verify-tls. The new name is preferred because pgBackRest does not support any SSL protocol versions (they are all considered to be insecure). The old name will continue to be accepted.

Documentation Improvements:

* Add FAQ to the documentation. (Contributed by Cynthia Shang.)
* Use wal_level=replica in the documentation for PostgreSQL ≥ 9.6. (Suggested by Patrick McLaughlin.)
2019-06-25 08:29:06 -04:00
David Steele
51fcaee43e Add host-repo-path variable internal replacement.
This variable needs to be replaced right before being used without being added to the cache since the host repo path will vary from system to system.

This is frankly a bit of a hack to get the documentation to build in the Debian packages for the upcoming release.  We'll need to come up with something more flexible going forward.
2019-06-25 07:58:38 -04:00
David Steele
5cbe2dee85 Add compress-level-network option to ls command.
039e515a added a dependency on compress-level-network but the ls command did not get updated.
2019-06-25 07:36:16 -04:00
David Steele
d7f12f268a Redact secure options in the help command.
Secure options could show up in the help as "current".  While the user must have permissions to see the source of the options (e.g. environment, config file) it's still not a good idea to display them in an unexpected context.

Instead show secure options as <redacted> in the help command.
2019-06-24 19:27:13 -04:00
David Steele
c22e10e4a9 Honor configure --prefix option.
The --prefix option was entirely ignored and DESTDIR was a combination of DESTDIR and bindir.

Bring both in line with recommendations for autoconf and make as specified in https://www.gnu.org/software/make/manual/html_node/Directory-Variables.html and https://www.gnu.org/prep/standards/html_node/DESTDIR.html.

Suggested by Daniel Westermann.
2019-06-24 15:42:33 -04:00
Cynthia Shang
b498188f01 Error on db history mismatch when expiring.
Amend commit 434cd832 to error when the db history in archive.info and backup.info do not match.

The Perl code would attempt to reconcile the history by matching on system id and version but we are not planning to migrate that code to C.  It's possible that there are users with mismatches but if so they should have been getting errors from info for the last six months.  It's easy enough to manually fix these files if there are any mismatches in the field.

Contributed by Cynthia Shang.
2019-06-24 11:59:44 -04:00
David Steele
039e515a31 Allow protocol compression when read/writing remote files.
If the file is compressible (i.e. not encrypted or already compressed) it can be marked as such in storageNewRead()/storageNewWrite().  If the file is being read from/written to a remote it will be compressed in transit using gzip.

Simplify filter group handling by having the IoRead/IoWrite objects create the filter group automatically.  This removes the need for a lot of NULL checking and has a negligible effect on performance since a filter group needs to be created eventually unless the source file is missing.

Allow filters to be created using a VariantList so filter parameters can be passed to the remote.
2019-06-24 10:20:47 -04:00
Cynthia Shang
62715ebf2d Fix archive retention expiring too aggressively.
The problem expressed when repo1-archive-retention-type was set to diff.  In this case repo1-archive-retention ended up being effectively equal to one, which meant PITR recovery was only possible from the last backup.  WAL required for consistency was still preserved for all backups.

This issue is not present in the C migration committed at 434cd832, which was written before this bug was reported.  Even so, we wanted to note this issue in the release notes in case any other users have been affected.

Fixed by Cynthia Shang.
Reported by Mohamad El-Rifai.
2019-06-19 17:49:38 -04:00
David Steele
a7d64bab7a Add FAQ on where to find old Debian/Ubuntu packages. 2019-06-18 19:02:09 -04:00
Cynthia Shang
e2d791394a Add FAQ to the documentation.
Contributed by Cynthia Shang.
2019-06-18 18:42:47 -04:00
David Steele
434cd83285 The expire command is implemented entirely in C.
This implementation duplicates the functionality of the Perl code but does so with different logic and includes full unit tests.

Along the way at least one bug was fixed, see issue #748.

Contributed by Cynthia Shang.
2019-06-18 15:19:20 -04:00
David Steele
f88bee7b33 TLS/HTTP statistics log replacements.
These statistics can change with any code update so they cause a lot of churn in the expect logs.
2019-06-18 10:13:28 -04:00
David Steele
0efdf2576f Remove hard-coded PostgreSQL user so $PGUSER works.
The PostgreSQL user was hard-coded to the OS user which libpq will automatically use if $PGUSER is not set, so this code was redundant and prevented $PGUSER from working when set.

Suggested by Julian Zhang, Janis Puris.
2019-06-18 07:35:34 -04:00
David Steele
593446718a Add S3 info type missed in 7f2f5354.
File is the only type possible in S3.
2019-06-18 06:45:47 -04:00
David Steele
0a96a2895d Add storage layer for tests and documentation.
The tests and documentation have been using the core storage layer but soon that will depend entirely on the C library, creating a bootstrap problem (i.e. the storage layer will be needed to build the C library).

Create a simplified Posix storage layer to be used by documentation and the parts of the test code that build and execute the actual tests.  The actual tests will still use the core storage driver so they can interact with any type of storage.
2019-06-17 09:16:44 -04:00
David Steele
ceafd8e19d Migrate page checksum filter to C.
This filter exactly mimics the behavior of the Perl filter so is a drop-in replacement.

The filter is not integrated yet since it requires the Perl-to-C storage layer interface coming in a future commit.
2019-06-17 07:52:03 -04:00
David Steele
892f35a728 Add new types to JSON render.
Still not a complete list, but we are getting there.
2019-06-17 07:42:12 -04:00
Cynthia Shang
c64c9c0590 Add backup management functions to InfoBackup.
Allow current backups to be listed and deleted.

Also expose some constants required by expire and stanza-* commands.

Contributed by Cynthia Shang.
2019-06-17 06:59:06 -04:00
Cynthia Shang
44bafc127d Rename info*New() functions to info*NewLoad().
These names more accurately reflect what the functions do and follow the convention started in Info and InfoPg.

Also remove the ignoreMissing parameter since it was never used.

Contributed by Cynthia Shang.
2019-06-17 06:47:15 -04:00
David Steele
f05fbc54a8 Fix filters not processing when there is no input.
Some filters (e.g. encryption and compression) produce output even if there is no input.  Since the filter group was marked as "done" initially, processing would not run when there was zero input and that resulted in zero output.

All filters start not done so start the filter group the same way.
2019-06-14 08:04:28 -04:00
David Steele
9ba95e993b Use retries to wait for test S3 server to start.
The prior method of tailing the docker log no longer seems reliable.  Instead, keep retrying the make bucket command until it works and show the error if it times out.
2019-06-13 17:58:33 -04:00
David Steele
b9233f7412 Create filter group in read/write object's memory context.
The filter group was being created in the parent context so it would go away if the parent context was freed.
2019-06-13 12:44:40 -04:00