]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Fix decoding of speculative aborts.
authorAmit Kapila <akapila@postgresql.org>
Tue, 15 Jun 2021 03:48:38 +0000 (09:18 +0530)
committerAmit Kapila <akapila@postgresql.org>
Tue, 15 Jun 2021 03:48:38 +0000 (09:18 +0530)
commit43acadfcebec36f4db2074e125b2af15d3afda1a
treea41da8a0bb8908a9ba8b93a1d001541ba6783a4b
parentdd53b46c78a0ac23e95f5bd1e4fb6cd011505cef
Fix decoding of speculative aborts.

During decoding for speculative inserts, we were relying for cleaning
toast hash on confirmation records or next change records. But that
could lead to multiple problems (a) memory leak if there is neither a
confirmation record nor any other record after toast insertion for a
speculative insert in the transaction, (b) error and assertion failures
if the next operation is not an insert/update on the same table.

The fix is to start queuing spec abort change and clean up toast hash
and change record during its processing. Currently, we are queuing the
spec aborts for both toast and main table even though we perform cleanup
while processing the main table's spec abort record. Later, if we have a
way to distinguish between the spec abort record of toast and the main
table, we can avoid queuing the change for spec aborts of toast tables.

Reported-by: Ashutosh Bapat
Author: Dilip Kumar
Reviewed-by: Amit Kapila
Backpatch-through: 9.6, where it was introduced
Discussion: https://postgr.es/m/CAExHW5sPKF-Oovx_qZe4p5oM6Dvof7_P+XgsNAViug15Fm99jA@mail.gmail.com
src/backend/replication/logical/decode.c
src/backend/replication/logical/reorderbuffer.c
src/include/replication/reorderbuffer.h