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: https://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的穩定性也是遠近聞名的。
參考
最後更新:2017-04-01 16:39:46