While testing the crash resilience of the recent 2-part-commit improvements, I've run into a problem where sometimes after a crash the recovery process creates zeroed files in pg_subtrans until it exhausts all disk space.
Not sure which patch you're talking about there (2-part-commit).
Looking at the code, it looks like it does not anticipate that the xid might wrap around, meaning startPage/endPage might also wrap around. But obviously should not do so at int_max but rather at some much smaller other value.
Hmm, looks like the != part attempted to wrap, but just didn't get it right.
Your patch looks right to me, so I will commit, barring objections... with backpatch. Likely to 9.0, AFAICS.
--
Simon Riggs http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services