Skip to content

Commit 76c68dc

Browse files
committed
(SUP-4210) Remove logic for EOL Postgres versions
This commit cleans up logic in the `psql_metrics` script that supported Postgres versions older than 10. These versions are all end of life upstream. Puppet Enterprise upgraded to PostgreSQL 11 with the 2019.2 release and Open Source PuppetDB started requiring PostgreSQL 11 with the 7.0.0 release.
1 parent b9ebb27 commit 76c68dc

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

files/psql_metrics

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,6 @@ module PuppetMetricsCollector
244244
else
245245
@pg_version = Gem::Version.new(@pg_version.strip)
246246
end
247-
# Some functions and statistics views were re-named in Postgres 10.0.
248-
@is_pg10 = Gem::Requirement.new('>= 10.0').satisfied_by?(@pg_version)
249247

250248
add_data!(@result, :checkpoints, sql_query(<<-EOS))
251249
SELECT json_build_object(
@@ -314,16 +312,14 @@ ORDER BY
314312
LIMIT 1;
315313
EOS
316314

317-
lsn_diff = @is_pg10 ? 'pg_wal_lsn_diff' : 'pg_xlog_location_diff'
318-
current_lsn = @is_pg10 ? 'pg_current_wal_lsn()' : 'pg_current_xlog_location()'
319315
add_data!(@result, :replication_slots, sql_query(<<-EOS))
320316
SELECT json_object_agg(
321317
slot_name,
322318
json_build_object(
323319
'active', active,
324320
'xmin', xmin,
325321
'catalog_xmin', catalog_xmin,
326-
'lag_bytes', #{lsn_diff}(#{current_lsn}, restart_lsn)
322+
'lag_bytes', pg_wal_lsn_diff(pg_current_wal_lsn(), restart_lsn)
327323
)
328324
)
329325
FROM

0 commit comments

Comments
 (0)