Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZrZ8Z-0002Iu-Cm for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2015 22:24:07 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZrZ8Y-0006ve-O4 for pgsql-bugs@arkaria.postgresql.org; Wed, 28 Oct 2015 22:24:06 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZrZ8X-0006vH-Sx for pgsql-bugs@postgresql.org; Wed, 28 Oct 2015 22:24:06 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1ZrZ8R-0003Tn-02 for pgsql-bugs@postgresql.org; Wed, 28 Oct 2015 22:24:04 +0000 Received: from intern.anarazel.de (unknown [37.85.20.96]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id 660F2860002; Wed, 28 Oct 2015 23:23:57 +0100 (CET) Date: Wed, 28 Oct 2015 23:23:56 +0100 From: Andres Freund To: Michael Paquier Cc: Adam =?utf-8?Q?Dratwi=C5=84ski?= , PostgreSQL mailing lists , Krzysiek Kotlarski Subject: Re: Long text values destroys logical replication slots Message-ID: <20151028222302.GK29811@alap3.anarazel.de> References: <853C54D9-7168-4852-99CF-49DCA1A7B48C@anarazel.de> <4B354135-2D94-48B2-8346-C1DF0CDD5DA7@anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org On 2015-10-28 23:00:53 +0100, Michael Paquier wrote: > On Wed, Oct 28, 2015 at 10:17 PM, Andres Freund 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