pgsql: Fix decoding of consecutive MULTI_INSERTs emitted by one heap_mu

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Fix decoding of consecutive MULTI_INSERTs emitted by one heap_mu
Date: 2014-07-12 12:49:25
Message-ID: E1X5wk1-0005Ax-Qj@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Fix decoding of consecutive MULTI_INSERTs emitted by one heap_multi_insert().

Commit 1b86c81d2d fixed the decoding of toasted columns for the rows
contained in one xl_heap_multi_insert record. But that's not actually
enough, because heap_multi_insert() will actually first toast all
passed in rows and then emit several *_multi_insert records; one for
each page it fills with tuples.

Add a XLOG_HEAP_LAST_MULTI_INSERT flag which is set in
xl_heap_multi_insert->flag denoting that this multi_insert record is
the last emitted by one heap_multi_insert() call. Then use that flag
in decode.c to only set clear_toast_afterwards in the right situation.

Expand the number of rows inserted via COPY in the corresponding
regression test to make sure that more than one heap page is filled
with tuples by one heap_multi_insert() call.

Backpatch to 9.4 like the previous commit.

Branch
------
REL9_4_STABLE

Details
-------
http://git.postgresql.org/pg/commitdiff/22ccce5206717036a06aefdf3f9f78ed9ffaab2f

Modified Files
--------------
contrib/test_decoding/expected/toast.out | 201 +++++++++++++++++++++++++++++-
contrib/test_decoding/sql/toast.sql | 199 +++++++++++++++++++++++++++++
src/backend/access/heap/heapam.c | 8 ++
src/backend/replication/logical/decode.c | 12 +-
src/include/access/heapam_xlog.h | 2 +
5 files changed, 419 insertions(+), 3 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Andres Freund 2014-07-12 12:49:26 pgsql: Fix decoding of consecutive MULTI_INSERTs emitted by one heap_mu
Previous Message Magnus Hagander 2014-07-12 12:23:14 pgsql: Add autocompletion of locale keywords for CREATE DATABASE