Set ReorderBufferTXN->final_lsn more eagerly
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 17 Jan 2020 21:00:39 +0000 (18:00 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Fri, 17 Jan 2020 21:00:39 +0000 (18:00 -0300)
commit20a1dc1e311d795fa37e5e4bd4f3d49157d78dba
treed588b8fa70e738d1ae7544510952fd74596db7cf
parent9be6fcb3e4e21c5d745dba314a451dc40f6f388b
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: http://postgr.es/m/CALDaNm2CLk+K9JDwjYST0sPbGg5AQdvhUt0jbKyX_HdAE0jk3A@mail.gmail.com
src/backend/replication/logical/reorderbuffer.c
src/include/replication/reorderbuffer.h