Fix record length computation in pg_waldump/xlogdump.
authorAndres Freund <andres@anarazel.de>
Mon, 5 Jun 2017 22:56:58 +0000 (15:56 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 5 Jun 2017 23:10:07 +0000 (16:10 -0700)
commitd3ca4b4b454fcd26de071f1556ec7b5e693514d4
tree7611d81a614579803ecd2a6fb65029020fe5857c
parentb64ff9c5af1e7e8c665f6fd76cecb0e3e82b0921
Fix record length computation in pg_waldump/xlogdump.

The current method of computing the record length (excluding the
lenght of full-page images) has been wrong since the WAL format has
been revamped in 2c03216d831160bedd72d45f712601b6f7d03f1c.  Only the
main record's length was counted, but that can be significantly too
little if there's data associated with further blocks.

Fix by computing the record length as total_lenght - fpi_length.

Reported-By: Chen Huajun
Bug: #14687
Reviewed-By: Heikki Linnakangas
Discussion: https://postgr.es/m/20170603165939.1436.58887@wrigleys.postgresql.org
Backpatch: 9.5-
src/bin/pg_xlogdump/pg_xlogdump.c