Skip NULLs in the pg_stat_replication (#2016)

Close https://github.com/zalando/patroni/issues/2014
This commit is contained in:
Alexander Kukushkin
2021-08-13 15:48:15 +02:00
committed by GitHub
parent c81391e314
commit ccfe30729e
+1 -1
View File
@@ -1077,7 +1077,7 @@ class Postgresql(object):
for app_name, sync_state, replica_lsn in self.query(
"SELECT pg_catalog.lower(application_name), sync_state, pg_{2}_{1}_diff({0}_{1}, '0/0')::bigint"
" FROM pg_catalog.pg_stat_replication"
" WHERE state = 'streaming'"
" WHERE state = 'streaming' AND {0}_{1} IS NOT NULL"
" ORDER BY sync_state DESC, {0}_{1} DESC".format(sort_col, self.lsn_name, self.wal_name)):
member = members.get(app_name)
if member and not member.tags.get('nosync', False):