Merge ~twom/launchpad:fix-getreplication-lag into launchpad:master

Proposed by Tom Wardill
Status: Merged
Approved by: Tom Wardill
Approved revision: 1ddeb43a52dcb33f8178ff656e6049a6743c61ee
Merge reported by: Otto Co-Pilot
Merged at revision: not available
Proposed branch: ~twom/launchpad:fix-getreplication-lag
Merge into: launchpad:master
Diff against target: 13 lines (+1/-1)
1 file modified
lib/lp/services/database/policy.py (+1/-1)
Reviewer Review Type Date Requested Status
Colin Watson (community) Approve
Review via email: mp+391040@code.launchpad.net

Commit message

Swap hot_standby for pg_is_in_recovery

Description of the change

Postgres 10 changes the default of `hot_standby` on `on`.
Change it for `pg_is_in_recovery` as that gives us the behaviour we want of telling us if there is actually a standby.

To post a comment you must log in.
Revision history for this message
Colin Watson (cjwatson) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/lp/services/database/policy.py b/lib/lp/services/database/policy.py
2index 066fdb3..691baf4 100644
3--- a/lib/lp/services/database/policy.py
4+++ b/lib/lp/services/database/policy.py
5@@ -358,7 +358,7 @@ class LaunchpadDatabasePolicy(BaseDatabasePolicy):
6 slave_store = self.getStore(MAIN_STORE, SLAVE_FLAVOR)
7 hot_standby, streaming_lag = slave_store.execute("""
8 SELECT
9- current_setting('hot_standby') = 'on',
10+ pg_is_in_recovery(),
11 now() - pg_last_xact_replay_timestamp()
12 """).get_one()
13 if hot_standby and streaming_lag is not None:

Subscribers

People subscribed via source and target branches

to status/vote changes: