|
| 1 | +## PostgreSQL 17 preview - 跟踪slot断联时间戳`pg_replication_slots.inactive_since` |
| 2 | + |
| 3 | +### 作者 |
| 4 | +digoal |
| 5 | + |
| 6 | +### 日期 |
| 7 | +2024-03-30 |
| 8 | + |
| 9 | +### 标签 |
| 10 | +PostgreSQL , PolarDB , DuckDB , slot , pg_replication_slots , 无效时间 , inactive_since |
| 11 | + |
| 12 | +---- |
| 13 | + |
| 14 | +## 背景 |
| 15 | +跟踪PostgreSQL slot断连时的时间戳. |
| 16 | + |
| 17 | +https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=a11f330b5584f2430371d68871e00f5c63735299 |
| 18 | +``` |
| 19 | +Track last_inactive_time in pg_replication_slots. |
| 20 | + |
| 21 | +author Amit Kapila <[email protected]> |
| 22 | +Mon, 25 Mar 2024 11:04:33 +0000 (16:34 +0530) |
| 23 | +committer Amit Kapila <[email protected]> |
| 24 | +Mon, 25 Mar 2024 11:04:33 +0000 (16:34 +0530) |
| 25 | +commit a11f330b5584f2430371d68871e00f5c63735299 |
| 26 | +tree b53cafab5f97bb5440db906e20ca0f38e46a0fd9 tree |
| 27 | +parent 0f7863afef67e462574fe5af6317e26a2f2d47fb commit | diff |
| 28 | +Track last_inactive_time in pg_replication_slots. |
| 29 | + |
| 30 | +This commit adds a new property called last_inactive_time for slots. It is |
| 31 | +set to 0 whenever a slot is made active/acquired and set to the current |
| 32 | +timestamp whenever the slot is inactive/released or restored from the disk. |
| 33 | +Note that we don't set the last_inactive_time for the slots currently being |
| 34 | +synced from the primary to the standby because such slots are typically |
| 35 | +inactive as decoding is not allowed on those. |
| 36 | + |
| 37 | +The 'last_inactive_time' will be useful on production servers to debug and |
| 38 | +analyze inactive replication slots. It will also help to know the lifetime |
| 39 | +of a replication slot - one can know how long a streaming standby, logical |
| 40 | +subscriber, or replication slot consumer is down. |
| 41 | + |
| 42 | +The 'last_inactive_time' will also be useful to implement inactive |
| 43 | +timeout-based replication slot invalidation in a future commit. |
| 44 | + |
| 45 | +Author: Bharath Rupireddy |
| 46 | +Reviewed-by: Bertrand Drouvot, Amit Kapila, Shveta Malik |
| 47 | +Discussion: https://www.postgresql.org/message-id/CALj2ACW4aUe-_uFQOjdWCEN-xXoLGhmvRFnL8SNw_TZ5nJe+aw@mail.gmail.com |
| 48 | +``` |
| 49 | + |
| 50 | +https://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=6d49c8d4b4f4a20eb5b4c501d78cf894fa13c0ea |
| 51 | +``` |
| 52 | +Change last_inactive_time to inactive_since in pg_replication_slots. |
| 53 | +author Amit Kapila <[email protected]> |
| 54 | +Wed, 27 Mar 2024 03:57:44 +0000 (09:27 +0530) |
| 55 | +committer Amit Kapila <[email protected]> |
| 56 | +Wed, 27 Mar 2024 03:57:44 +0000 (09:27 +0530) |
| 57 | +commit 6d49c8d4b4f4a20eb5b4c501d78cf894fa13c0ea |
| 58 | +tree 67eaaf5d79dea7aede098b19222897923894be78 tree |
| 59 | +parent bb952c8c8b13279eca039499249cb5dc60991603 commit | diff |
| 60 | +Change last_inactive_time to inactive_since in pg_replication_slots. |
| 61 | + |
| 62 | +Commit a11f330b55 added last_inactive_time to show the last time the slot |
| 63 | +was inactive. But, it tells the last time that a currently-inactive slot |
| 64 | +previously *WAS* active. This could be unclear, so we changed the name to |
| 65 | +inactive_since. |
| 66 | + |
| 67 | +Reported-by: Robert Haas |
| 68 | +Author: Bharath Rupireddy |
| 69 | +Reviewed-by: Bertrand Drouvot, Shveta Malik, Amit Kapila |
| 70 | +Discussion: https://postgr.es/m/CA+Tgmob_Ta-t2ty8QrKHBGnNLrf4ZYcwhGHGFsuUoFrAEDw4sA@mail.gmail.com |
| 71 | +Discussion: https://postgr.es/m/CALj2ACUXS0SfbHzsX8bqo+7CZhocsV52Kiu7OWGb5HVPAmJqnA@mail.gmail.com |
| 72 | +``` |
| 73 | + |
0 commit comments