Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iqU6H-0008M6-B6 for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 03:39:41 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iqU6G-00040y-1g for pgsql-hackers@arkaria.postgresql.org; Sun, 12 Jan 2020 03:39:40 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iqU6F-00040q-L9 for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 03:39:39 +0000 Received: from mail-wm1-x342.google.com ([2a00:1450:4864:20::342]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1iqU6A-0006z6-Kb for pgsql-hackers@lists.postgresql.org; Sun, 12 Jan 2020 03:39:38 +0000 Received: by mail-wm1-x342.google.com with SMTP id a5so6062303wmb.0 for ; Sat, 11 Jan 2020 19:39:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=DzqVQsVjbWTPzim1d0DeEhVkeVGgDxocitTdkkqarpw=; b=F2xI0KqllIQ75mrdo1i25hm4TjDC4bMZ4m8786Bem/iUnDeEStfsl4/VRIAxD7tPeY lJ8Pu36tsUwPh5/lcmwrk+d9RjuGQT6HiCLQwy2dAL2hF811JzY7oz/FfY7T/BqSZOTe JWkdO8sj7o7NS803p8P9Of+9LtqJj9vw1zOPG/GbK0hP1ybCkplKG1o8SftVGKNPj3fP mx9s4YWgfEpVGuhIWyT+WzORkDZ07suPmo0NBX/VWZwHLN0EL1lwycRBOrcwGBBoo51E uPj3OperHHe3CNMaAOkyFr81M28y2BqokTH/vk4oeh/Gde+VCOZaE+owyw61ZP7HFtyc v2cA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=DzqVQsVjbWTPzim1d0DeEhVkeVGgDxocitTdkkqarpw=; b=RAf8Kf9CqlFnHfhzh4bYEw1TybDUidOleLSHEaXoFw1qOIRtBw8+avCmjAvHxBmn1y 8pYrBZK2ifskqW5B0CgPYh1+dV6ZPnWK5U8Cq6VopqUYiT9WA2aGGe33FBAguRquXEBk Aum1QrG2c668tmQh2QOfKyz25phAo+RrX/tFEG5fwWFiBbVnWgkDD8qWOYlmf2FYW335 uDTDeAuMfwOGn//LeidojnEBGqTh5Dzwvg8BfJ4r6ZHNDd05qSHPVFyINgZ2XpP2Qobg 2uMN1+UnZBv+i7CLtGVzcVTyr/yj6ZMkO9d3cJg2MNkgjG8KJWcEScu22Bt2Ktjehn4K +mdw== X-Gm-Message-State: APjAAAXyfpQHYKFVZMoy3kZ5OLqbMEGGajMAczZH+dj6MBCMRm2BrEaN /Cey6V2hmkNxNf4euz2/4kUQcA== X-Google-Smtp-Source: APXvYqy5Wyoo1p9vfEAOvXy8QVieeLnsTuY5raDIaxU700qA+G8/WLW1MIn0bkKIFKm10FeN0nxaxw== X-Received: by 2002:a1c:f210:: with SMTP id s16mr12352358wmc.57.1578800373109; Sat, 11 Jan 2020 19:39:33 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id z187sm8981784wme.16.2020.01.11.19.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 11 Jan 2020 19:39:31 -0800 (PST) Date: Sun, 12 Jan 2020 04:39:30 +0100 From: Tomas Vondra To: Tom Lane Cc: Amit Kapila , Noah Misch , Amit Khandekar , Alvaro Herrera from 2ndQuadrant , Andres Freund , Juan =?utf-8?B?Sm9zw6kgU2FudGFtYXLDrWE=?= Flecha , PostgreSQL Hackers , Robert Haas , Thomas Munro Subject: Re: logical decoding : exceeded maxAllocatedDescs for .spill files Message-ID: <20200112033930.6cy3n6ybft6pp7gw@development> References: <20200104185148.GA2270238@rfd.leadboat.com> <20200109053704.GA2502006@rfd.leadboat.com> <22498.1578548741@sss.pgh.pa.us> <14739.1578613901@sss.pgh.pa.us> <18117.1578616812@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <18117.1578616812@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Jan 09, 2020 at 07:40:12PM -0500, Tom Lane wrote: >I wrote: >> ReorderBuffer: 223302560 total in 26995 blocks; 7056 free (3 chunks); 223295504 used > >> The test case is only inserting 50K fairly-short rows, so this seems >> like an unreasonable amount of memory to be consuming for that; and >> even if you think it's reasonable, it clearly isn't going to scale >> to large production transactions. > >> Now, the good news is that v11 and later get through >> 006_logical_decoding.pl just fine under the same restriction. >> So we did something in v11 to fix this excessive memory consumption. >> However, unless we're willing to back-port whatever that was, this >> test case is clearly consuming excessive resources for the v10 branch. > >I dug around a little in the git history for backend/replication/logical/, >and while I find several commit messages mentioning memory leaks and >faulty spill logic, they all claim to have been back-patched as far >as 9.4. > >It seems reasonably likely to me that this result is telling us about >an actual bug, ie, faulty back-patching of one or more of those fixes >into v10 and perhaps earlier branches. > >I don't know this code well enough to take point on looking for the >problem, though. > Well, one thing we did in 11 is introduction of the Generation context. In 10 we're still stashing all tuple data into the main AllocSet. I wonder if backporting a4ccc1cef5a04cc054af83bc4582a045d5232cb3 and a couple of follow-up fixes would make the issue go away. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services