pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andres Freund <andres@anarazel.de>
To: Michael Paquier <michael.paquier@gmail.com>
Cc: Adam DratwiƄski <adam.dratwinski@gmail.com>
Cc: PostgreSQL mailing lists <pgsql-bugs@postgresql.org>
Cc: Krzysiek Kotlarski <kotlarski.krzysztof@gmail.com>
Subject: Re: Long text values destroys logical replication slots
Date: Wed, 28 Oct 2015 23:23:56 +0100
Message-ID: <20151028222302.GK29811@alap3.anarazel.de> (raw)
In-Reply-To: <CAB7nPqRk4-rdKnXb=qTynyw1JgM9txDdg__XciZ6nOyQxjY+ng@mail.gmail.com>
References: <CAKg6ypLd7773AOX4DiOGRwQk1TVOQKhNwjYiVjJnpq8Wo+i62Q@mail.gmail.com>
	<853C54D9-7168-4852-99CF-49DCA1A7B48C@anarazel.de>
	<CAKg6ypJcXr9x4p10gWp217SWG9q=MvB1d702BhAKu9keHrf2iw@mail.gmail.com>
	<4B354135-2D94-48B2-8346-C1DF0CDD5DA7@anarazel.de>
	<CAB7nPqRk4-rdKnXb=qTynyw1JgM9txDdg__XciZ6nOyQxjY+ng@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2015-10-28 23:00:53 +0100, Michael Paquier wrote:
> On Wed, Oct 28, 2015 at 10:17 PM, Andres Freund <andres@anarazel.de> wrote:
> > Can you reproduce it with test_decoding as the output plugin?
> 
> You can just use that for example to get an assertion failure:
> CREATE TABLE a (b text);
> ALTER TABLE ONLY a REPLICA IDENTITY FULL;
> SELECT * FROM pg_create_logical_replication_slot('new', 'test_decoding');
> INSERT INTO a (b) VALUES (repeat('k', 2000000));
> UPDATE a SET b = 'c';
> select * from pg_logical_slot_peek_changes('new', NULL, NULL); -- boom
> 
> frame #3: 0x0000000100458ca9
> postgres`DecodeXLogTuple(data=0x00007fb7e2126046, len=22910,
> tuple=0x000000010a32e038) + 137 at decode.c:856
>    853         int            datalen = len - SizeOfHeapHeader;
>    854
>    855         Assert(datalen >= 0);
> -> 856         Assert(datalen <= MaxHeapTupleSize);
> (lldb) p datalen
> (int) $0 = 22905

Ugh, that's some monumental stupidity on my side in the handling of
oldtuple values. Newtuple datums never can be bigger than 8k (all
relevant columns point into toasted datums)- but that's absolutely not
the case for the "old" values.  That can't happen for primary keys (due
to the btree limitations), which is why this wasn't noticed so far.
Gotta think about this one.

Greetings,

Andres Freund


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (10+ messages)  latest in thread

Message-ID: <20151028222302.GK29811@alap3.anarazel.de>
Permalink:  ../20151028222302.GK29811@alap3.anarazel.de/
Also on:    postgresql.org/message-id/20151028222302.GK29811@alap3.anarazel.de

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: andres@anarazel.de, michael.paquier@gmail.com, adam.dratwinski@gmail.com, kotlarski.krzysztof@gmail.com
  Subject: Re: Long text values destroys logical replication slots
  In-Reply-To: <20151028222302.GK29811@alap3.anarazel.de>
  References: <CAKg6ypLd7773AOX4DiOGRwQk1TVOQKhNwjYiVjJnpq8Wo+i62Q@mail.gmail.com> <853C54D9-7168-4852-99CF-49DCA1A7B48C@anarazel.de> <CAKg6ypJcXr9x4p10gWp217SWG9q=MvB1d702BhAKu9keHrf2iw@mail.gmail.com> <4B354135-2D94-48B2-8346-C1DF0CDD5DA7@anarazel.de> <CAB7nPqRk4-rdKnXb=qTynyw1JgM9txDdg__XciZ6nOyQxjY+ng@mail.gmail.com> <20151028222302.GK29811@alap3.anarazel.de>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

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