Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u3OCv-00F2pY-1i for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Apr 2025 23:54:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1u3OCs-00G0tr-TS for pgsql-bugs@arkaria.postgresql.org; Fri, 11 Apr 2025 23:54:47 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1u3OCs-00G0ti-KG for pgsql-bugs@lists.postgresql.org; Fri, 11 Apr 2025 23:54:46 +0000 Received: from sss.pgh.pa.us ([68.162.161.243]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1u3OCr-004Nqt-0W for pgsql-bugs@lists.postgresql.org; Fri, 11 Apr 2025 23:54:46 +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 53BNseZL1026036; Fri, 11 Apr 2025 19:54:40 -0400 From: Tom Lane To: Vinod Sridharan cc: niek.brasa@hitachienergy.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18831: Particular queries using gin-indexes are not interruptible, resulting is resource usage concerns. In-reply-to: References: <18831-e845ac44ebc5dd36@postgresql.org> <474911.1741207802@sss.pgh.pa.us> Comments: In-reply-to Vinod Sridharan message dated "Fri, 11 Apr 2025 16:38:29 -0700" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1026034.1744415680.1@sss.pgh.pa.us> Date: Fri, 11 Apr 2025 19:54:40 -0400 Message-ID: <1026035.1744415680@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Vinod Sridharan writes: > I believe there may be an issue with the above patch - specifically in > the case of the triConsistent logic dealing with op-classes that use > the consistent function. In the shimTriConsistentFn, the key's > entryRes values are directly mutated to set to GIN_FALSE (if there's > fewer than MAX_MAYBE_ENTRIES entries). At the end of this method, > they're not reset back to GIN_MAYBE. Consequently, the next loop of > the ginFillScanEntry now may incorrectly assume that the remaining > entries are GIN_FALSE when they started as GIN_MAYBE: previously they > were hard reset for every iteration of the ginFillScanEntry loop. The > attached patch seems to fix it by resetting any mutated values back > before returning. However, this would also reset it during the regular > triConsistent check per tuple. This patch would be more convincing with a test case demonstrating that there's a problem. regards, tom lane