作者
digoal
日期
2021-11-07
标签
PostgreSQL , 实时归档 , pg_receivewal , 压缩
https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=babbbb595d2322da095a1e6703171b3f1f2815cb
Add support for LZ4 compression in pg_receivewal author Michael Paquier <michael@paquier.xyz> Fri, 5 Nov 2021 02:33:25 +0000 (11:33 +0900) committer Michael Paquier <michael@paquier.xyz> Fri, 5 Nov 2021 02:33:25 +0000 (11:33 +0900) commit babbbb595d2322da095a1e6703171b3f1f2815cb tree 2822626ff97ea4f4f88f6776354e79e40a07925f tree parent 5cd7eb1f1c32e1b95894f28b277b4e4b89add772 commit | diff Add support for LZ4 compression in pg_receivewal pg_receivewal gains a new option, --compression-method=lz4, available when the code is compiled with --with-lz4. Similarly to gzip, this gives the possibility to compress archived WAL segments with LZ4. This option is not compatible with --compress. The implementation uses LZ4 frames, and is compatible with simple lz4 commands. Like gzip, using --synchronous ensures that any data will be flushed to disk within the current .partial segment, so as it is possible to retrieve as much WAL data as possible even from a non-completed segment (this requires completing the partial file with zeros up to the WAL segment size supported by the backend after decompression, but this is the same as gzip). The calculation of the streaming start LSN is able to transparently find and check LZ4-compressed segments. Contrary to gzip where the uncompressed size is directly stored in the object read, the LZ4 chunk protocol does not store the uncompressed data by default. There is contentSize that can be used with LZ4 frames by that would not help if using an archive that includes segments compressed with the defaults of a "lz4" command, where this is not stored. So, this commit has taken the most extensible approach by decompressing the already-archived segment to check its uncompressed size, through a blank output buffer in chunks of 64kB (no actual performance difference noticed with 8kB, 16kB or 32kB, and the operation in itself is actually fast). Tests have been added to verify the creation and correctness of the generated LZ4 files. The latter is achieved by the use of command "lz4", if found in the environment. The tar-based WAL method in walmethods.c, used now only by pg_basebackup, does not know yet about LZ4. Its code could be extended for this purpose. Author: Georgios Kokolatos Reviewed-by: Michael Paquier, Jian Guo, Magnus Hagander, Dilip Kumar Discussion: https://postgr.es/m/ZCm1J5vfyQ2E6dYvXz8si39HQ2gwxSZ3IpYaVgYa3lUwY88SLapx9EEnOf5uEwrddhx2twG7zYKjVeuP5MwZXCNPybtsGouDsAD1o2L_I5E=@pm.me
复制
266 <varlistentry> 267 <term><option>--compression-method=<replaceable class="parameter">method</replaceable></option></term> 268 <listitem> 269 <para> 270 Enables compression of write-ahead logs using the specified method. 271 Supported values <literal>gzip</literal>, <literal>lz4</literal> 272 (if <productname>PostgreSQL</productname> was compiled with 273 <option>--with-lz4</option>), and <literal>none</literal>. 274 </para> 275 276 <para> 277 The suffix <filename>.gz</filename> will automatically be added to 278 all filenames when using <literal>gzip</literal>, and the suffix 279 <filename>.lz4</filename> is added when using <literal>lz4</literal>. 280 </para> 281 </listitem> 282 </varlistentry>
复制
期望 PostgreSQL 增加什么功能?
类似Oracle RAC架构的PostgreSQL已开源: 阿里云PolarDB for PostgreSQL云原生分布式开源数据库!
PostgreSQL 解决方案集合
德哥 / digoal's github - 公益是一辈子的事.
「喜欢这篇文章,您的关注和赞赏是给作者最好的鼓励」
关注作者
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文章的来源(墨天轮),文章链接,文章作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。
评论
相关阅读
明明想执行的SQL是DELETE、UPDATE,但为什么看到的是SELECT(FDW的实现原理解析)
小满未满、
379次阅读
2025-03-19 23:11:26
PostgreSQL初/中/高级认证考试(3.15)通过考生公示
开源软件联盟PostgreSQL分会
352次阅读
2025-03-20 09:50:36
IvorySQL 4.4 发布 - 基于 PostgreSQL 17.4,增强平台支持
通讯员
222次阅读
2025-03-20 15:31:04
openHalo问世,全球首款基于PostgreSQL兼容MySQL协议的国产开源数据库
严少安
212次阅读
2025-04-07 12:14:29
命名不规范,事后泪两行
xiongcc
204次阅读
2025-03-13 14:26:08
PG vs MySQL 执行计划解读的异同点
进击的CJR
144次阅读
2025-03-21 10:50:08
版本发布| IvorySQL 4.4 发布
IvorySQL开源数据库社区
131次阅读
2025-03-13 09:52:33
PostgreSQL分区管理扩展——pg_partman
chirpyli
114次阅读
2025-03-19 15:48:31
手把手教你在 openKylin 上部署 IvorySQL 4.4
严少安
110次阅读
2025-03-27 20:41:28
postgresql+patroni+etcd高可用安装
necessary
109次阅读
2025-03-28 10:11:23
热门文章
阿里巴巴的使命、愿景、核心价值观
2021-01-04 67605浏览
MacOS 关闭和开启虚拟内存(swap)
2022-01-20 17582浏览
[珍藏级] PostgreSQL ssl 证书配置 - 防止中间攻击者 - 以及如何使用证书无密码登录配置cert
2020-06-19 16486浏览
PostgreSQL md5hash插件 - 128bit 存储,压缩空间、提升效率
2019-11-08 14336浏览
产品与运营-OKR的设计、总结、复盘、规划、组织保障和考核例子
2022-01-20 13120浏览
最新文章
PostgreSQL 15 preview - PostgreSQL 15 pg_stat_statements 增加对temp file blocks io timing的统计, 增加JIT的统计.
2022-01-20 265浏览
德说-第92期, 怎么解决躺平|不想奋斗?
2022-01-20 299浏览
PostgreSQL 增量物化视图插件 - pg_ivm incremental materialized view maintenance
2022-01-20 1377浏览
PostgreSQL 15 preview - ARM多核适配 性能提升 - Use ISB as a spin-delay instruction on ARM64
2022-01-20 767浏览
PostgreSQL 15 preview - recovery(包括崩溃恢复、逻辑流复制、物理流复制、归档恢复) 加速, 支持异步prefetch 预读接下来要恢复的wal record相关的data block到shared buffer
2022-01-20 1201浏览