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

947 Commits

Author SHA1 Message Date
David Steele
f314a1f8aa Improve accuracy of strSizeFormat().
Casting to int caused large values to be slightly inaccurate so cast to uint64_t instead.

Also, use multiplication where possible since the compiler should precompute multiplied values.
2019-01-13 22:22:15 +02:00
David Steele
cebcb3f027 Null-terminate list returned by strLstPtr().
The null-terminator is required by many C functions that accept a string list so just add it in all cases rather than making it optional.
2019-01-10 09:49:28 +02:00
David Steele
ade2c3102d Ignore SIGPIPE signals and check EPIPE result instead.
SIGPIPE immediately terminates the process but we would rather catch the EPIPE error and gracefully shutdown.

Ignore SIGPIPE and throw the EPIPE error via normal error handling.
2019-01-06 17:42:44 +02:00
Douglas J Hunley
7272d6e247 Add _DARWIN_C_SOURCE flag to Makefile for MacOS builds.
For some reason adding -D_POSIX_C_SOURCE=200112L caused MacOS builds to stop working.  Combining both flags seems to work fine for all tested systems.

Contributed by Douglas J Hunley.
2019-01-06 17:28:17 +02:00
David Steele
9560baf659 Move C module include in test.c above headers included for testing.
Including the C module after the headers required for testing meant that if headers were missing from the C module they were not caught while directly testing the C module.

The missing headers were caught in general testing, but it is frustrating to get an error in a module that has already passed while testing another module or running CI.

Move the C module include to the very top so missing headers cause immediate failures.
2019-01-06 15:52:59 +02:00
David Steele
1de22cac2b Rename common/io/handle module to common/io/handleWrite.
ioHandleWriteOneStr() will become a helper function for the IoHandleWrite object.
2019-01-06 14:37:39 +02:00
David Steele
200fd3aa05 Clarify that encryption is always performed client-side.
Suggested by Bruce Burdick.
2019-01-04 12:25:58 +02:00
David Steele
50717aa846 Begin v2.09 development. 2019-01-04 11:00:59 +02:00
David Steele
db24ff8df4 v2.08: Minor Improvements and Bug Fixes
Bug Fixes:

* Remove request for S3 object info directly after putting it. (Reported by Matt Kunkel.)
* Correct archive-get-queue-max to be size type. (Reported by Ronan Dunklau.)
* Add error message when current user uid/gid does not map to a name. (Reported by Camilo Aguilar.)
* Error when --target-action=shutdown specified for PostgreSQL < 9.5.

Improvements:

* Set TCP keepalives on S3 connections. (Suggested by Ronan Dunklau.)
* Reorder info command text output so most recent backup is output last. (Contributed by Cynthia Shang. Suggested by Ryan Lambert.)
* Change file ownership only when required.
* Redact authentication header when throwing S3 errors. (Suggested by Brad Nicholson.)
2019-01-02 22:04:47 +02:00
David Steele
26c888873e Merge common/typeVariantListTest module into common/typeVariantTest.
These modules are closely related so it makes sense for them to be merged.
2019-01-01 18:14:43 +02:00
David Steele
07b9176f25 Merge common/typeStringListTest module into common/typeStringTest.
These modules are closely related so it makes sense for them to be merged.
2019-01-01 18:05:13 +02:00
David Steele
493fb78787 Add strLstInsert() and strLstInsertZ() to StringList object.
Use lstInsert() to implement insertions into any position in a StringList.
2019-01-01 17:31:23 +02:00
Cynthia Shang
cc6376fdb6 Modify general document elements to allow any child element.
This allows for nesting of elements such as <b> and <i>.

Contributed by Cynthia Shang.
2018-12-31 09:19:38 +02:00
Cynthia Shang
2b7440ddf3 Allow custom logo for PDF documentation.
Contributed by Cynthia Shang.
2018-12-31 08:51:00 +02:00
Cynthia Shang
72865ca33b Add admonitions to documentation renderers.
Admonitions call out places where the user should take special care.

Support added for HTML, PDF, Markdown and help text renderers.  XML files have been updated accordingly.

Contributed by Cynthia Shang.
2018-12-30 16:40:20 +02:00
Cynthia Shang
3dc327fd05 Add optional table captions.
All renderers now support table captions, when requested.

Contributed by Cynthia Shang.
2018-12-20 23:20:54 +02:00
Cynthia Shang
8cf8d29f12 Escape special characters in latex when not in a code block.
A number of common characters are not allowed in latex without being escaped.

Also convert some HTML-specific codes that are used in the documentation.

Contributed by Cynthia Shang.
2018-12-19 19:13:26 +02:00
David Steele
23b583336f Set TCP keepalives on S3 connections.
Keepalives may help in situations where RST packets are being blocked by a firewall or otherwise do not arrive.

The C code uses select on all reads so it should never block, but add keepalives just in case.

Suggested by Ronan Dunklau.
2018-12-18 22:12:59 +02:00
Cynthia Shang
96028073cb Add HTML table rendering and update PDF/Markdown renderers to support header-less tables.
Contributed by Cynthia Shang.
2018-12-18 22:02:23 +02:00
Cynthia Shang
b85e51d6d5 Base menu ordering on natural ordering in the manifest.
Menu ordering was alphabetical which is not ideal for a user interface.

Contributed by Cynthia Shang.
2018-12-14 18:46:12 -05:00
Cynthia Shang
35bbb5bd68 Reorder info command text output so most recent backup is output last.
After a stanza-upgrade backups for the old cluster are displayed until they expire.  Cluster info was output newest to oldest which meant after an upgrade the most recent backup would no longer be output last.

Update the text output ordering so the most recent backup is always output last.

Contributed by Cynthia Shang.
Suggested by Ryan Lambert.
2018-12-14 18:25:31 -05:00
Cynthia Shang
205525b607 Migrate local info command to C.
The info command will only be executed in C if the repository is local, i.e. not located on a remote repository host.  S3 is considered "local" in this case.

This is a direct migration from Perl to integrate as seamlessly with the remaining Perl code as possible. It should not be possible to determine if the C version is running unless debug-level logging is enabled.

Contributed by Cynthia Shang.
2018-12-13 16:22:34 -05:00
Cynthia Shang
e6ef40e8a3 Add infoBackup object to encapsulate the backup.info file.
The infoBackup object is the counterpart to the infoArchive object which encapsulates the archive.info file.

Currently the object is read-only, i.e. it is not possible to create a new or modify an existing backup.info file.

There a number of constants that will also be used in the infoManifest object so go ahead and create a module to contain them so they don't need to be moved later.

Contributed by Cynthia Shang.
2018-12-13 15:46:18 -05:00
David Steele
d6dfbfd2f3 Add zlib1g-dev to Debian builds.
Not all debian-based distros were getting this installed.
2018-12-12 14:35:44 -05:00
David Steele
df947cfcb2 Add documentation for building the documentation.
A basic primer for building the documentation.  Lots that could be added, but it's a start.
2018-12-12 13:52:23 -05:00
David Steele
fdc76742c8 Use absolute paths so that ./doc.pl runs.
The relative paths used would not correctly find required libraries and DTD files.
2018-12-12 13:48:31 -05:00
David Steele
ee04ebe314 Fix Centos/RHEL 7 documentation builds.
This was caused by a new container version that was released around December 5th.  The new version explicitly denies user logons by leaving /var/run/nologin in place after boot.

The solution is to enable the service that is responsible for removing this file on a successful boot.
2018-12-12 11:15:09 -05:00
Cynthia Shang
2f15a90d18 Add infoArchiveIdHistoryMatch() to the InfoArchive object.
Match a PostgreSQL system identifier and version to a pgBackRest archive id.

Contributed by Cynthia Shang.
2018-12-10 18:45:57 -05:00
Cynthia Shang
f0417ee524 Use cast to make for loop more readable in InfoPg module.
The previous way worked but was a head-scratcher when reading the code.  This cast hopefully makes it a bit more obvious what is going on.

Contributed by Cynthia Shang.
2018-12-10 18:31:49 -05:00
Cynthia Shang
2514d08d0d Remove #define statements in the InfoPg module to conform with newly-adopted coding standards.
Contributed by Cynthia Shang.
2018-12-10 18:15:06 -05:00
Cynthia Shang
fe152b8f29 Rename constants in Info module for consistency.
INFO is generally used as the prefix for info file constants so rename these accordingly.

Also follow newly-adopted coding standards for when #define is required for a static String constant.

Contributed by Cynthia Shang.
2018-12-10 18:08:26 -05:00
Cynthia Shang
e3435ec386 Add path expression for repository backup to the storage helper.
This is the counterpart to the archive path expression and constructs paths into the backup part of the repository.

Contributed by Cynthia Shang.
2018-12-10 17:35:31 -05:00
Cynthia Shang
4f539db8d9 Allow NULL stanza in storage helper.
Some commands (e.g. info) do not take a stanza or the stanza is optional.  In that case it is the job of the command to construct the repository path with a stanza as needed.

Update helper functions to omit the stanza from the constructed path when it is NULL.

Contributed by Cynthia Shang.
2018-12-10 17:01:33 -05:00
Cynthia Shang
cbf514e191 Improve info error messages introduced in 74b72df9.
- Add detail to errors when info files are loaded with incorrect encryption settings.
- Throw FileMissingError rather than FileOpenError when both copies of the info file are missing.
- If one file is present (but errors) and the other is missing, then return the error for the file that was present.

Contributed by Cynthia Shang.
2018-12-10 16:32:41 -05:00
Cynthia Shang
80a3e21521 Add strSizeFormat() to String object.
Converts sizes in bytes to a more human-readable form, .e.g. 1KB, 1.1GB.

Contributed by Cynthia Shang.
2018-12-10 16:11:51 -05:00
David Steele
1c5f8f45b6 Add configuration to the standby so it works as a primary when promoted.
This code was generated during testing and it seemed a good idea to keep it.  It is only a partial solution since the primary also needs additional configuration to be able to fail back and forth.
2018-12-07 12:32:10 -05:00
David Steele
495391c743 Pick pg_switch_wal()/pg_switch_xlog() based on PostgreSQL version.
One step in making the documentation build for all versions that we support.
2018-12-07 12:19:28 -05:00
David Steele
e6abdfb5b8 Add error message when current user uid/gid does not map to a name.
This condition resulted in a nasty stack trace dump when the undefined value was used later on.

Reported by Camilo Aguilar.
2018-12-07 07:41:26 -05:00
David Steele
e73416e9e3 Change file ownership only when required.
Previously chown() would be called even when no ownership changes were required.

In most cases changes are not required and it seems better to perform an extra stat() rather than an extra chown().

Also add unit tests for owner() since there weren't any.
2018-12-05 17:56:47 -05:00
David Steele
e96986a4e1 Error when --target-action=shutdown specified for PostgreSQL < 9.5.
This equaled "promote" on unsupported versions which qualifies as a surprising behavior.
2018-12-05 16:21:45 -05:00
David Steele
5b52f02021 Clarify when target-action is effective and PostgreSQL version support.
Suggested by Keith Fiske.
2018-12-05 15:58:45 -05:00
David Steele
a0ecf53ead Fix documentation typo. 2018-12-05 13:07:55 -05:00
David Steele
bf873be4aa Redact authentication header when throwing S3 errors.
The authentication header contains the access key (not the secret key) so don't include it in errors that can be seen at any log level.

Suggested by Brad Nicholson.
2018-12-05 12:51:13 -05:00
David Steele
cc6447356e Fix test binary name for gprof.
This got missed in 1f8931f7 when the test binary was renamed.

Also output call graph along with the flat report.  The flat report is generally most useful but it doesn't hurt to have both.
2018-12-05 09:15:45 -05:00
David Steele
33fa2ede7d Add Centos/RHEL 7 option to documentation build.
Centos/RHEL 7 builds can be specified with --var=os-type=centos7.

Also added to the documentation release and CI builds.
2018-12-05 07:12:28 -05:00
David Steele
baeff9e4f0 Create common if expressions for testing os-type.
These expressions simplify os-type testing.  This will be especially true as more OS types are added.
2018-12-04 17:33:56 -05:00
David Steele
9e217d0256 Documentation may be built with user-specified packages.
By default the documentation builds pgBackRest from source, but the documentation is also a good way to smoke-test packages.

Allow a package file to be specified by passing --var=package=/path/to/package.ext.  This works for Debian and CentOS 6 builds.
2018-12-04 13:17:55 -05:00
David Steele
0db030fa63 Add coding standards for String constants. 2018-12-04 11:46:25 -05:00
David Steele
14190f9e6c Update URL for Docker install.
As usual the old URL started providing a broken version of Docker rather than producing a clear error message.  This happens once a year or so.
2018-12-03 12:41:53 -05:00
David Steele
17e611cb88 Replace keywords with more flexible if statements.
Keywords were extremely limited and prevented us from generating multi-version documentation and other improvements.

Replace keywords with an if statement that can evaluate a Perl expression with variable replacement.

Since keywords were used to generate cache keys, add a --key-var parameter to identify which variables should make up the key.
2018-12-01 12:40:01 -05:00