pg.ddx.io pgsql-committers@postgresql.org mailing list archivehelp / color / mirror / Atom feed
pgsql: logical decoding: Fix handling of large old tuples with replica 3+ messages / 1 participants [nested] [flat]
* pgsql: logical decoding: Fix handling of large old tuples with replica @ 2016-03-06 02:16 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2016-03-06 02:16 UTC (permalink / raw) To: pgsql-committers logical decoding: Fix handling of large old tuples with replica identity full. When decoding the old version of an UPDATE or DELETE change, and if that tuple was bigger than MaxHeapTupleSize, we either Assert'ed out, or failed in more subtle ways in non-assert builds. Normally individual tuples aren't bigger than MaxHeapTupleSize, with big datums toasted. But that's not the case for the old version of a tuple for logical decoding; the replica identity is logged as one piece. With the default replica identity btree limits that to small tuples, but that's not the case for FULL. Change the tuple buffer infrastructure to separate allocate over-large tuples, instead of always going through the slab cache. This unfortunately requires changing the ReorderBufferTupleBuf definition, we need to store the allocated size someplace. To avoid requiring output plugins to recompile, don't store HeapTupleHeaderData directly after HeapTupleData, but point to it via t_data; that leaves rooms for the allocated size. As there's no reason for an output plugin to look at ReorderBufferTupleBuf->t_data.header, remove the field. It was just a minor convenience having it directly accessible. Reported-By: Adam Dratwiński Discussion: CAKg6ypLd7773AOX4DiOGRwQk1TVOQKhNwjYiVjJnpq8Wo+i62Q@mail.gmail.com Branch ------ master Details ------- http://git.postgresql.org/pg/commitdiff/c8f621c43a599b35dc004ee09627bf4688cbbb84 Modified Files -------------- contrib/test_decoding/expected/toast.out | 58 ++++++++++++ contrib/test_decoding/sql/toast.sql | 37 ++++++++ src/backend/replication/logical/decode.c | 57 +++++++----- src/backend/replication/logical/reorderbuffer.c | 114 +++++++++++++++++------- src/include/replication/reorderbuffer.h | 19 ++-- 5 files changed, 222 insertions(+), 63 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: logical decoding: Fix handling of large old tuples with replica @ 2016-03-06 02:16 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2016-03-06 02:16 UTC (permalink / raw) To: pgsql-committers logical decoding: Fix handling of large old tuples with replica identity full. When decoding the old version of an UPDATE or DELETE change, and if that tuple was bigger than MaxHeapTupleSize, we either Assert'ed out, or failed in more subtle ways in non-assert builds. Normally individual tuples aren't bigger than MaxHeapTupleSize, with big datums toasted. But that's not the case for the old version of a tuple for logical decoding; the replica identity is logged as one piece. With the default replica identity btree limits that to small tuples, but that's not the case for FULL. Change the tuple buffer infrastructure to separate allocate over-large tuples, instead of always going through the slab cache. This unfortunately requires changing the ReorderBufferTupleBuf definition, we need to store the allocated size someplace. To avoid requiring output plugins to recompile, don't store HeapTupleHeaderData directly after HeapTupleData, but point to it via t_data; that leaves rooms for the allocated size. As there's no reason for an output plugin to look at ReorderBufferTupleBuf->t_data.header, remove the field. It was just a minor convenience having it directly accessible. Reported-By: Adam Dratwiński Discussion: CAKg6ypLd7773AOX4DiOGRwQk1TVOQKhNwjYiVjJnpq8Wo+i62Q@mail.gmail.com Branch ------ REL9_5_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/5990a034adfe4b777b07be10bd71730f1868e48d Modified Files -------------- contrib/test_decoding/expected/toast.out | 58 ++++++++++++ contrib/test_decoding/sql/toast.sql | 37 ++++++++ src/backend/replication/logical/decode.c | 57 +++++++----- src/backend/replication/logical/reorderbuffer.c | 114 +++++++++++++++++------- src/include/replication/reorderbuffer.h | 19 ++-- 5 files changed, 222 insertions(+), 63 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
* pgsql: logical decoding: Fix handling of large old tuples with replica @ 2016-03-06 02:16 Andres Freund <andres@anarazel.de> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2016-03-06 02:16 UTC (permalink / raw) To: pgsql-committers logical decoding: Fix handling of large old tuples with replica identity full. When decoding the old version of an UPDATE or DELETE change, and if that tuple was bigger than MaxHeapTupleSize, we either Assert'ed out, or failed in more subtle ways in non-assert builds. Normally individual tuples aren't bigger than MaxHeapTupleSize, with big datums toasted. But that's not the case for the old version of a tuple for logical decoding; the replica identity is logged as one piece. With the default replica identity btree limits that to small tuples, but that's not the case for FULL. Change the tuple buffer infrastructure to separate allocate over-large tuples, instead of always going through the slab cache. This unfortunately requires changing the ReorderBufferTupleBuf definition, we need to store the allocated size someplace. To avoid requiring output plugins to recompile, don't store HeapTupleHeaderData directly after HeapTupleData, but point to it via t_data; that leaves rooms for the allocated size. As there's no reason for an output plugin to look at ReorderBufferTupleBuf->t_data.header, remove the field. It was just a minor convenience having it directly accessible. Reported-By: Adam Dratwiński Discussion: CAKg6ypLd7773AOX4DiOGRwQk1TVOQKhNwjYiVjJnpq8Wo+i62Q@mail.gmail.com Branch ------ REL9_4_STABLE Details ------- http://git.postgresql.org/pg/commitdiff/3b94b3a496fd978ce481ba147627569bf7adc58f Modified Files -------------- contrib/test_decoding/expected/toast.out | 58 ++++++++++++ contrib/test_decoding/sql/toast.sql | 37 ++++++++ src/backend/replication/logical/decode.c | 82 ++++++++++------- src/backend/replication/logical/reorderbuffer.c | 116 +++++++++++++++++------- src/include/replication/reorderbuffer.h | 15 ++- 5 files changed, 236 insertions(+), 72 deletions(-) -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2016-03-06 02:16 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2016-03-06 02:16 pgsql: logical decoding: Fix handling of large old tuples with replica Andres Freund <andres@anarazel.de> 2016-03-06 02:16 pgsql: logical decoding: Fix handling of large old tuples with replica Andres Freund <andres@anarazel.de> 2016-03-06 02:16 pgsql: logical decoding: Fix handling of large old tuples with replica Andres Freund <andres@anarazel.de>
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox