Skip to content

Latest commit

 

History

History
88 lines (57 loc) · 4.45 KB

20230406_04.md

File metadata and controls

88 lines (57 loc) · 4.45 KB

PostgreSQL 16 preview - pg_dump compress选项新增支持: zstd

作者

digoal

日期

2023-04-06

标签

PostgreSQL , PolarDB , pg_dump , compress , none , gzip , lz4 , zstd


背景

pg_dump目前支持的压缩算法包括: gzip, lz4, zstd, 或者不压缩(none)

https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=84adc8e20f54e93a003cd316fa1eb9b03e393288

pg_dump: Add support for zstd compression  
author	Tomas Vondra <tomas.vondra@postgresql.org>	  
Wed, 5 Apr 2023 19:38:04 +0000 (21:38 +0200)  
committer	Tomas Vondra <tomas.vondra@postgresql.org>	  
Wed, 5 Apr 2023 19:39:33 +0000 (21:39 +0200)  
commit	84adc8e20f54e93a003cd316fa1eb9b03e393288  
tree	aae55866ab14cb7cda70c7d482e04b215efb0596	tree  
parent	794f25944790ed0462cde3d6dc0f1ad02fcd6bba	commit | diff  
pg_dump: Add support for zstd compression  
  
Allow pg_dump to use the zstd compression, in addition to gzip/lz4. Bulk  
of the new compression method is implemented in compress_zstd.{c,h},  
covering the pg_dump compression APIs. The rest of the patch adds test  
and makes various places aware of the new compression method.  
  
The zstd library (which this patch relies on) supports multithreaded  
compression since version 1.5. We however disallow that feature for now,  
as it might interfere with parallel backups on platforms that rely on  
threads (e.g. Windows). This can be improved / relaxed in the future.  
  
This also fixes a minor issue in InitDiscoverCompressFileHandle(), which  
was not updated to check if the file already has the .lz4 extension.  
  
Adding zstd compression was originally proposed in 2020 (see the second  
thread), but then was reworked to use the new compression API introduced  
in e9960732a9. I've considered both threads when compiling the list of  
reviewers.  
  
Author: Justin Pryzby  
Reviewed-by: Tomas Vondra, Jacob Champion, Andreas Karlsson  
Discussion: https://postgr.es/m/20230224191840.GD1653@telsasoft.com  
Discussion: https://postgr.es/m/20201221194924.GI30237@telsasoft.com  
+        as though it had been fed through <application>gzip</application>,  
+        <application>lz4</application>, or <application>zstd</application>;  
+        but the default is not to compress.  
  
+           can be compressed with the <application>gzip</application>,  
+           <application>lz4</application>, or  
+           <application>zstd</application> tools.  
           <literal>none</literal> for no compression  

digoal's wechat