Closed schinns closed 4 years ago
Addresses issue https://github.com/film42/pgreba/issues/3.
Reads pg_current_wal_lsn from primary and pg_last_wal_receive_lsn from replica and gets byte lag from pg_wal_lsn_diff(lsn, lsn).
pg_current_wal_lsn
pg_last_wal_receive_lsn
pg_wal_lsn_diff(lsn, lsn)
postgres=# select pg_current_wal_lsn(); -[ RECORD 1 ]------+---------- pg_current_wal_lsn | 0/4000108
postgres=# select pg_last_wal_receive_lsn(); -[ RECORD 1 ]-----------+---------- pg_last_wal_receive_lsn | 0/4000108
postgres=# postgres=# select pg_wal_lsn_diff('0/4000108', '0/4000108'); -[ RECORD 1 ]---+-- pg_wal_lsn_diff | 0
example payload:
{ "state":0, "postmaster_start_time":"2020-08-07 08:54:37.141 MDT", "role":"replica", "xlog":{ "location":0, "received_location":1694501464, "replayed_location":1694501464, "replayed_timestamp":null, "paused":false }, "replication":[ ], "byte_lag: 0 }
Dude! Awesome work here! Left two comments, but this is really really good!
Looks great! Thanks for your work on this! Enjoy the PNW :)
Thanks @film42 for reviewing and providing feedback!
Addresses issue https://github.com/film42/pgreba/issues/3.
Reads
pg_current_wal_lsn
from primary andpg_last_wal_receive_lsn
from replica and gets byte lag frompg_wal_lsn_diff(lsn, lsn)
.example payload: