Commit ec0d993
committed
fix: WAL health panel false positive on idle databases
The WAL health stat panel (ID 612) shows "Unsynced" (red) on idle
databases where no WAL activity is occurring, even though the archiver
is functioning correctly.
PostgreSQL's archive_timeout only forces WAL segment switches when
there are records in the current segment. On idle databases (common in
staging/dev), no new WAL segments are produced, causing
seconds_since_last_archival to grow indefinitely and the panel to
turn red.
Fix: multiply the archival age by whether there are actually WAL
files pending archival (ready > 0). When no WALs are pending, the
result is 0 (Healthy) since the archiver has nothing to do.
Fixes #55
Signed-off-by: Christoph Ebeling <c.ebeling@nexode.de>1 parent 8f1461d commit ec0d993
1 file changed
Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1973 | 1973 | | |
1974 | 1974 | | |
1975 | 1975 | | |
1976 | | - | |
| 1976 | + | |
1977 | 1977 | | |
1978 | 1978 | | |
1979 | 1979 | | |
| |||
2133 | 2133 | | |
2134 | 2134 | | |
2135 | 2135 | | |
2136 | | - | |
| 2136 | + | |
2137 | 2137 | | |
2138 | 2138 | | |
2139 | 2139 | | |
| |||
0 commit comments