Skip to content

Latest commit

 

History

History
97 lines (66 loc) · 5.09 KB

20240330_03.md

File metadata and controls

97 lines (66 loc) · 5.09 KB

PostgreSQL 17 preview - 跟踪slot断联时间戳pg_replication_slots.inactive_since

作者

digoal

日期

2024-03-30

标签

PostgreSQL , PolarDB , DuckDB , slot , pg_replication_slots , 无效时间 , inactive_since


背景

跟踪PostgreSQL slot断连时的时间戳.

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

Track last_inactive_time in pg_replication_slots.  
  
author	Amit Kapila <akapila@postgresql.org>	  
Mon, 25 Mar 2024 11:04:33 +0000 (16:34 +0530)  
committer	Amit Kapila <akapila@postgresql.org>	  
Mon, 25 Mar 2024 11:04:33 +0000 (16:34 +0530)  
commit	a11f330b5584f2430371d68871e00f5c63735299  
tree	b53cafab5f97bb5440db906e20ca0f38e46a0fd9	tree  
parent	0f7863afef67e462574fe5af6317e26a2f2d47fb	commit | diff  
Track last_inactive_time in pg_replication_slots.  
  
This commit adds a new property called last_inactive_time for slots. It is  
set to 0 whenever a slot is made active/acquired and set to the current  
timestamp whenever the slot is inactive/released or restored from the disk.  
Note that we don't set the last_inactive_time for the slots currently being  
synced from the primary to the standby because such slots are typically  
inactive as decoding is not allowed on those.  
  
The 'last_inactive_time' will be useful on production servers to debug and  
analyze inactive replication slots. It will also help to know the lifetime  
of a replication slot - one can know how long a streaming standby, logical  
subscriber, or replication slot consumer is down.  
  
The 'last_inactive_time' will also be useful to implement inactive  
timeout-based replication slot invalidation in a future commit.  
  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Amit Kapila, Shveta Malik  
Discussion: https://www.postgresql.org/message-id/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com  

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

Change last_inactive_time to inactive_since in pg_replication_slots.  
author	Amit Kapila <akapila@postgresql.org>	  
Wed, 27 Mar 2024 03:57:44 +0000 (09:27 +0530)  
committer	Amit Kapila <akapila@postgresql.org>	  
Wed, 27 Mar 2024 03:57:44 +0000 (09:27 +0530)  
commit	6d49c8d4b4f4a20eb5b4c501d78cf894fa13c0ea  
tree	67eaaf5d79dea7aede098b19222897923894be78	tree  
parent	bb952c8c8b13279eca039499249cb5dc60991603	commit | diff  
Change last_inactive_time to inactive_since in pg_replication_slots.  
  
Commit a11f330b55 added last_inactive_time to show the last time the slot  
was inactive. But, it tells the last time that a currently-inactive slot  
previously *WAS* active. This could be unclear, so we changed the name to  
inactive_since.  
  
Reported-by: Robert Haas  
Author: Bharath Rupireddy  
Reviewed-by: Bertrand Drouvot, Shveta Malik, Amit Kapila  
Discussion: https://postgr.es/m/CA+Tgmob_Ta-t2ty8QrKHBGnNLrf4ZYcwhGHGFsuUoFrAEDw4sA@mail.gmail.com  
Discussion: https://postgr.es/m/CALj2ACUXS0SfbHzsX8bqo+7CZhocsV52Kiu7OWGb5HVPAmJqnA@mail.gmail.com  

digoal's wechat