pg_stat_replication.sync_state was displayed incorrectly at page boundary.

Heikki Linnakangas <heikki.linnakangas@iki.fi>

Commit: 38b38fb12244c640230b1fd71d2c55ecc04844fa
Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
Date: 2012-11-23T17:14:41Z
Releases: 9.1.7
pg_stat_replication.sync_state was displayed incorrectly at page boundary.

XLogRecPtrIsInvalid() only checks the xrecoff field, which is correct when
checking if a WAL record could legally begin at the given position, but WAL
sending can legally be paused at a page boundary, in which case xrecoff is
0. Use XLByteEQ(..., InvalidXLogRecPtr) instead, which checks that both
xlogid and xrecoff are 0.

9.3 doesn't have this problem because XLogRecPtr is now a single 64-bit
integer, so XLogRecPtrIsInvalid() does the right thing. Apply to 9.2, and
9.1 where pg_stat_replication view was introduced.

Kyotaro HORIGUCHI, reviewed by Fujii Masao.

Files

PathChange+/−
src/backend/replication/syncrep.c modified +3 −2
src/backend/replication/walsender.c modified +3 −2