Log the correct ending timestamp in recovery_target_xid mode.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jan 2023 17:23:20 +0000 (12:23 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 19 Jan 2023 17:23:20 +0000 (12:23 -0500)
commit1b9a0b96a8701ddcd147836241f89d616772d332
tree33cba6b956527eb7d7c029ada418f28048503eeb
parentfed4e92f3bfd4dfbbee472fb4b0b86d9b9100a3c
Log the correct ending timestamp in recovery_target_xid mode.

When ending recovery based on recovery_target_xid matching with
recovery_target_inclusive = off, we printed an incorrect timestamp
(always 2000-01-01) in the "recovery stopping before ... transaction"
log message.  This is a consequence of sloppy refactoring in
c945af80c: the code to fetch recordXtime out of the commit/abort
record used to be executed unconditionally, but it was changed
to get called only in the RECOVERY_TARGET_TIME case.  We need only
flip the order of operations to restore the intended behavior.

Per report from Torsten Förtsch.  Back-patch to all supported
branches.

Discussion: https://postgr.es/m/CAKkG4_kUevPqbmyOfLajx7opAQk6Cvwkvx0HRcFjSPfRPTXanA@mail.gmail.com
src/backend/access/transam/xlog.c