Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VFWDq-0001qS-FK for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Aug 2013 21:27:14 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VFWDp-0003Rd-W0 for pgsql-bugs@arkaria.postgresql.org; Fri, 30 Aug 2013 21:27:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VFWDp-0003RW-1u for pgsql-bugs@postgresql.org; Fri, 30 Aug 2013 21:27:13 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VFWDm-0004sU-4g for pgsql-bugs@postgresql.org; Fri, 30 Aug 2013 21:27:12 +0000 Received: from anarazel.de (p54AF4A79.dip0.t-ipconnect.de [84.175.74.121]) by mrelayeu.kundenserver.de (node=mrbap3) with ESMTP (Nemesis) id 0MXXss-1VUTvu255y-00WYzY; Fri, 30 Aug 2013 23:27:08 +0200 Received: by anarazel.de (Postfix, from userid 1000) id D924C100A6D; Fri, 30 Aug 2013 23:27:07 +0200 (CEST) Date: Fri, 30 Aug 2013 23:27:07 +0200 From: Andres Freund To: Alvaro Herrera Cc: terje@elde.net, pgsql-bugs@postgresql.org Subject: Re: BUG #8410: out of binary heap slots Message-ID: <20130830212707.GC8932@awork2.anarazel.de> References: <20130830210015.GA8932@awork2.anarazel.de> <20130830210525.GB8932@awork2.anarazel.de> <20130830211532.GA5931@eldon.alvh.no-ip.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20130830211532.GA5931@eldon.alvh.no-ip.org> X-Provags-ID: V02:K0:ImfW78n3ldOeO6UevzQUyzoRdbDqY6yGq4QxvUuF2dk VP1MX1OjNOXDsHHyQlvrF1j/mlh+8u71W5Oax9FhxEeS1pNyXQ LSNscZv1hssVlhLTjkV6W0EjUfRL5CPigY8SuJgf4t2+lH2C1b 5B00bFJvcbnxC9yZJZYhr0P2PI7MktxEp6JIyMMt2deZ5vpACf bk7XDbfwlQtiD0FWCPl/7kwgw75USKBn2BfrU9kQUhxPrUNE/c z+rFNOfo6HFSy5tXQf1l3H2I815NhsZX7DOA+uscUfKSDmJZyi BPyABfKLaPfLsYXQmGfyy30ZPt4doNum5yDIP9q5kCy3dEG7nq 9bSzVuAIh/SL2UXaXeWDyK8/DobMH4sOVyoJGvwZB X-Pg-Spam-Score: -1.9 (-) 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 2013-08-30 17:15:32 -0400, Alvaro Herrera wrote: > Andres Freund wrote: > > > No need, found the bug. And I think can build a testcase myself. > > > > ExecReScanMergeAppend resets ms_initialized, but doesn't clear the > > binaryheap. Thus no new elements fit. > > Um. Are we missing a binaryheap_clear() method? In the patch I am patch-to-be it's binaryheap_reset(), but yes ;). Are you already patching it, or do you want me to finish it? I have a not so nice testcase and I can confirm that this is the issue and that a binaryheap_reset() fixes it: SELECT (SELECT g.i FROM ((SELECT random()::int ORDER BY 1 OFFSET 0) UNION ALL (SELECT random()::int ORDER BY 1 OFFSET 0)) f(i) ORDER BY f.i LIMIT 1) FROM generate_series(1, 10) g(i); Greetings, Andres Freund -- Andres Freund http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs