Refrain from duplicating data in reorderbuffers
authorAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 6 Mar 2018 19:22:03 +0000 (16:22 -0300)
committerAlvaro Herrera <alvherre@alvh.no-ip.org>
Tue, 6 Mar 2018 21:34:29 +0000 (18:34 -0300)
commit8aa75e1384b1c62e302db02e6006fc6a2885afeb
treee04b79c21d0da7cb9e06a0ecdad8a257f7fe908a
parent286c0ab257f8dde8e5494426b86c38f3877ae5c2
Refrain from duplicating data in reorderbuffers

If a walsender exits leaving data in reorderbuffers, the next walsender
that tries to decode the same transaction would append its decoded data
in the same spill files without truncating it first, which effectively
duplicate the data.  Avoid that by removing any leftover reorderbuffer
spill files when a walsender starts.

Backpatch to 9.4; this bug has been there from the very beginning of
logical decoding.

Author: Craig Ringer, revised by me
Reviewed by: Álvaro Herrera, Petr Jelínek, Masahiko Sawada
src/backend/replication/logical/reorderbuffer.c