PostgreSQL 10.0 preview 功能增强 - CLOG oldest XID跟踪

标签

PostgreSQL , 10.0 , oldest xid , XID , clog


背景

PostgreSQL tuple中记录的xmin,xmax事务号是uint32类型,所以是一个rotate使用的方式,需要frozen。

CLOG存储的是oldest XID之后的XID,也就是说这个XID之后的事务,都保留了事务提交的状态值,之前的CLOG可能被删除或者正在被删除。

这个patch与从CLOG获取事务状态相关,允许提交一个任意的XID值,不管在CLOG是否在TRUNCATE过程中,都可以安全的返回被查询的事务号的提交状态,(通过跟踪TRUNCATE过程中被清除的事务状态实现)。

Track the oldest XID that can be safely looked up in CLOG.  
  
This provides infrastructure for looking up arbitrary, user-supplied  
XIDs without a risk of scary-looking failures from within the clog  
module.  Normally, the oldest XID that can be safely looked up in CLOG  
is the same as the oldest XID that can reused without causing  
wraparound, and the latter is already tracked.  However, while  
truncation is in progress, the values are different, so we must  
keep track of them separately.  
  
Craig Ringer, reviewed by Simon Riggs and by me.  
  
Discussion: http://postgr.es/m/CAMsr+YHQiWNEi0daCTboS40T+V5s_+dst3PYv_8v2wNVH+Xx4g@mail.gmail.com  

对此增加了一个等待事件信息

+         <entry><literal>CLogTruncationLock</></entry>  
+         <entry>Waiting to truncate the transaction log or waiting for transaction log truncation to finish.</entry>  

这个patch的讨论,详见邮件组,本文末尾URL。

PostgreSQL社区的作风非常严谨,一个patch可能在邮件组中讨论几个月甚至几年,根据大家的意见反复的修正,patch合并到master已经非常成熟,所以PostgreSQL的稳定性也是远近闻名的。

参考

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值