postgresql/src/backend/replication/logical
Andres Freund 61633f7904 Correct logical decoding restore behaviour for subtransactions.
Before initializing iteration over a subtransaction's changes, the last
few changes were not spilled to disk. That's correct if the transaction
didn't spill to disk, but otherwise... This bug can lead to missed or
misorderd subtransaction contents when they were spilled to disk.

Move spilling of the remaining in-memory changes to
ReorderBufferIterTXNInit(), where it can easily be applied to the top
transaction and, if present, subtransactions.

Since this code had too many bugs already, noticeably increase test
coverage.

Fixes: #14319
Reported-By: Huan Ruan
Discussion: <20160909012610.20024.58169@wrigleys.postgresql.org>
Backport: 9,4-, where logical decoding was added
2016-10-03 22:11:36 -07:00
..
Makefile Generic Messages for Logical Decoding 2016-04-06 10:05:41 +01:00
decode.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
logical.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00
logicalfuncs.c Add location field to DefElem 2016-09-06 12:00:00 -04:00
message.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
origin.c pgindent run for 9.6 2016-06-09 18:02:36 -04:00
reorderbuffer.c Correct logical decoding restore behaviour for subtransactions. 2016-10-03 22:11:36 -07:00
snapbuild.c Add macros to make AllocSetContextCreate() calls simpler and safer. 2016-08-27 17:50:38 -04:00