File tree Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Expand file tree Collapse file tree 3 files changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -17,7 +17,7 @@ class Pool(object):
1717 ),
1818 "replication_lag_slave_query" : (
1919 """
20- SELECT CASE WHEN coalesce(pg_last_{1}(), '0/00000000') = coalesce(pg_last_{2}(), '0/00000000')
20+ SELECT CASE WHEN NOT pg_is_in_recovery() OR coalesce(pg_last_{1}(), '0/00000000') = coalesce(pg_last_{2}(), '0/00000000')
2121 THEN 0
2222 ELSE extract (epoch FROM now() - coalesce(pg_last_xact_replay_timestamp(), now() - INTERVAL '{0} seconds'))
2323 END;
Original file line number Diff line number Diff line change @@ -23,7 +23,7 @@ class Xlog(Plugin):
2323 """
2424 # get time of replication lag
2525 query_agent_replication_lag = """
26- SELECT CASE WHEN coalesce(pg_last_{1}(), '0/00000000') = coalesce(pg_last_{2}(), '0/00000000')
26+ SELECT CASE WHEN NOT pg_is_in_recovery() OR coalesce(pg_last_{1}(), '0/00000000') = coalesce(pg_last_{2}(), '0/00000000')
2727 THEN 0
2828 ELSE extract (epoch FROM now() - coalesce(pg_last_xact_replay_timestamp(), now() - INTERVAL '{0} seconds'))
2929 END;
Original file line number Diff line number Diff line change 4949CREATE OR REPLACE FUNCTION mamonsu.timestamp_get()
5050RETURNS double precision AS $$
5151 SELECT
52- CASE WHEN pg_last_{11}() = pg_last_{12}() THEN 0
52+ CASE WHEN NOT pg_is_in_recovery() OR pg_last_{11}() = pg_last_{12}() THEN 0
5353 ELSE extract (epoch FROM now() - coalesce(pg_last_xact_replay_timestamp(), to_timestamp(ts)))
5454 END
5555 FROM mamonsu.timestamp_master_{1}
You can’t perform that action at this time.
0 commit comments