Set ReorderBufferTXN->final_lsn more eagerly ... specifically, set it incrementally as each individual change is spilled down to disk. This way, it is set correctly when the transaction disappears without trace, ie. without leaving an XACT_ABORT wal record. (This happens when the server crashes midway through a transaction.)
Failing to have final_lsn prevents ReorderBufferRestoreCleanup() from working, since it needs the final_lsn in order to know the endpoint of its iteration through spilled files. Commit df9f682c7bf8 already tried to fix the problem, but it didn't set the final_lsn in all cases. Revert that, since it's no longer needed. Author: Vignesh C Reviewed-by: Amit Kapila, Dilip Kumar Discussion: https://postgr.es/m/caldanm2clk+k9jdwjyst0spbgg5aqdvhut0jbkyx_hdae0j...@mail.gmail.com Branch ------ REL9_6_STABLE Details ------- https://git.postgresql.org/pg/commitdiff/cdb14154bb00e711152f4011417b3e44ea85adea Modified Files -------------- src/backend/replication/logical/reorderbuffer.c | 29 ++++++++++--------------- src/include/replication/reorderbuffer.h | 7 +++--- 2 files changed, 16 insertions(+), 20 deletions(-)