Skip to content

Commit 1aff88b

Browse files
authored
Merge pull request #197 from Sharpie/SUP-4210-remove-postgres-10-compat
(SUP-4210) Remove logic for EOL Postgres versions
2 parents dcffbb5 + 76c68dc commit 1aff88b

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)