暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

PostgreSQL 13 增加流复制slot保留wal上限参数 - max_slot_wal_keep_size

digoal 2020-07-20
1341

作者

digoal

日期

2020-07-20

标签

PostgreSQL , max_slot_wal_keep_size , 物理复制 , slot , wal堆积


背景

以前的版本, 只要使用slot, 数据库会记录slot的wal复制位点, 并在wal文件夹中保留所有未发送的wal文件.

如果客户创建了slot但是后期不再使用, 那么可能导致数据库的wal日志爆仓.

PG 13支持设置slot保留上限, 防止人为误操作导致的wal爆仓.

```
Rename wal_keep_segments to wal_keep_size. master github/master
author Fujii Masao fujii@postgresql.org
Mon, 20 Jul 2020 12:30:18 +0800 (13:30 +0900)
committer Fujii Masao fujii@postgresql.org
Mon, 20 Jul 2020 12:30:18 +0800 (13:30 +0900)
commit c3fe108c025e4a080315562d4c15ecbe3f00405e
tree b70e9db2e58fedb9abd6506574629f1e5ca75386 tree | snapshot
parent 0bead9af484c1d0a67e690fda47011addaa5bc9d commit | diff
Rename wal_keep_segments to wal_keep_size.

max_slot_wal_keep_size that was added in v13 and wal_keep_segments are
the GUC parameters to specify how much WAL files to retain for
the standby servers. While max_slot_wal_keep_size accepts the number of
bytes of WAL files, wal_keep_segments accepts the number of WAL files.
This difference of setting units between those similar parameters could
be confusing to users.

To alleviate this situation, this commit renames wal_keep_segments to
wal_keep_size, and make users specify the WAL size in it instead of
the number of WAL files.

There was also the idea to rename max_slot_wal_keep_size to
max_slot_wal_keep_segments, in the discussion. But we have been moving
away from measuring in segments, for example, checkpoint_segments was
replaced by max_wal_size. So we concluded to rename wal_keep_segments
to wal_keep_size.

Back-patch to v13 where max_slot_wal_keep_size was added.

Author: Fujii Masao
Reviewed-by: Álvaro Herrera, Kyotaro Horiguchi, David Steele
Discussion: https://postgr.es/m/574b4ea3-e0f9-b175-ead2-ebea7faea855@oss.nttdata.com
```

参考

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

PostgreSQL 许愿链接

您的愿望将传达给PG kernel hacker、数据库厂商等, 帮助提高数据库产品质量和功能, 说不定下一个PG版本就有您提出的功能点. 针对非常好的提议,奖励限量版PG文化衫、纪念品、贴纸、PG热门书籍等,奖品丰富,快来许愿。开不开森.

9.9元购买3个月阿里云RDS PostgreSQL实例

PostgreSQL 解决方案集合

德哥 / digoal's github - 公益是一辈子的事.

digoal's wechat

文章转载自digoal,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论