diff options
author | Robert Haas <rhaas@postgresql.org> | 2022-03-30 09:35:14 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2022-03-30 09:41:26 -0400 |
commit | 51c0d186d99a18e6aae53003f5138f20991e15a6 (patch) | |
tree | 0c37c8899e6448c1bd56919741f58e8e5a99c7b5 /src/include/common/backup_compression.h | |
parent | c6863b85829149e2241faafa161b6c5af1f06cb9 (diff) |
Allow parallel zstd compression when taking a base backup.
libzstd allows transparent parallel compression just by setting
an option when creating the compression context, so permit that
for both client and server-side backup compression. To use this,
use something like pg_basebackup --compress WHERE-zstd:workers=N
where WHERE is "client" or "server" and N is an integer.
When compression is performed on the server side, this will spawn
threads inside the PostgreSQL backend. While there is almost no
PostgreSQL server code which is thread-safe, the threads here are used
internally by libzstd and touch only data structures controlled by
libzstd.
Patch by me, based in part on earlier work by Dipesh Pandit
and Jeevan Ladhe. Reviewed by Justin Pryzby.
Discussion: http://postgr.es/m/CA+Tgmobj6u-nWF-j=FemygUhobhryLxf9h-wJN7W-2rSsseHNA@mail.gmail.com
Diffstat (limited to 'src/include/common/backup_compression.h')
-rw-r--r-- | src/include/common/backup_compression.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/include/common/backup_compression.h b/src/include/common/backup_compression.h index 0565cbc657d..6a0ecaa99c9 100644 --- a/src/include/common/backup_compression.h +++ b/src/include/common/backup_compression.h @@ -23,12 +23,14 @@ typedef enum bc_algorithm } bc_algorithm; #define BACKUP_COMPRESSION_OPTION_LEVEL (1 << 0) +#define BACKUP_COMPRESSION_OPTION_WORKERS (1 << 1) typedef struct bc_specification { bc_algorithm algorithm; unsigned options; /* OR of BACKUP_COMPRESSION_OPTION constants */ int level; + int workers; char *parse_error; /* NULL if parsing was OK, else message */ } bc_specification; |