Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kS67n-0006ka-Ng for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Oct 2020 22:16:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kS67m-0003J7-9k for pgsql-bugs@arkaria.postgresql.org; Mon, 12 Oct 2020 22:16:58 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kS67m-0003Iz-3c for pgsql-bugs@lists.postgresql.org; Mon, 12 Oct 2020 22:16:58 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kS67j-0006S7-B8 for pgsql-bugs@lists.postgresql.org; Mon, 12 Oct 2020 22:16:57 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 09CMGqdJ3395319; Mon, 12 Oct 2020 18:16:52 -0400 From: Tom Lane To: Pavel Borisov cc: Alexander Lakhin , pgsql-bugs@lists.postgresql.org Subject: Re: BUG #16329: Valgrind detects an invalid read when building a gist index with buffering In-reply-to: References: <16329-7a6aa9b6fa1118a1@postgresql.org> <3dda6945-c147-5afc-7720-38ec6848dafa@gmail.com> <10261.1588705157@sss.pgh.pa.us> <93ca4540-0016-8217-2b31-535613499987@gmail.com> <06f117b8-bbc1-4190-d204-ef329121cbca@gmail.com> Comments: In-reply-to Pavel Borisov message dated "Mon, 12 Oct 2020 16:30:02 +0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3395317.1602541012.1@sss.pgh.pa.us> Date: Mon, 12 Oct 2020 18:16:52 -0400 Message-ID: <3395318.1602541012@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Pavel Borisov writes: > Also, there is a minor correction for the case of covering index where only > part of the columns are keys, others are just INCLUDE columns. Yeah, that's clearly a bug, and it reinforces the point about wanting more thorough test coverage of this area. I pushed the bug fix, but not yet the test addition, because I'm not very happy about the latter: 1. It nearly triples the runtime of gist.sql, from ~650 ms to ~1700 ms on my machine. That's a pretty bad increase for something we're proposing to drop into the core regression tests. Given that this is hardly the only index build in that test, I wonder why it's so much (but I did not look for the reason). 2. The test exposed the gistRelocateBuildBuffersOnSplit bug only about one time in ten for me. I suppose this is due to the random split choices gistchoose makes for equally-good tuples, so it's not terribly surprising; but it is problematic for a test that we're hoping to use to provide reliable code coverage. I'm not really sure what we could do about #2. Perhaps, instead of relying on random(), we could make gistchoose() use our own PRNG and then invent a debugging function that forces the seed to a known value. (GEQO already does something similar, although I'd not go as far as exposing the seed as a GUC. Resetting it via some quick-hack C function in regress.c would be enough IMO.) Or perhaps gist.sql could be adjusted so that the test data is less full of equally-good tuples. regards, tom lane