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 1qOUTW-0080Ke-3w for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Jul 2023 02:42:05 +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 1qOUTT-001jYJ-IP for pgsql-bugs@arkaria.postgresql.org; Wed, 26 Jul 2023 02:42:03 +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 1qOUTT-001jYA-9q for pgsql-bugs@lists.postgresql.org; Wed, 26 Jul 2023 02:42:03 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qOUTP-001bG1-NL for pgsql-bugs@lists.postgresql.org; Wed, 26 Jul 2023 02:42:02 +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 36Q2fvaY1821882; Tue, 25 Jul 2023 22:41:57 -0400 From: Tom Lane To: Kyotaro Horiguchi cc: exclusion@gmail.com, pgsql-bugs@lists.postgresql.org Subject: Re: BUG #18014: Releasing catcache entries makes schema_to_xmlschema() fail when parallel workers are used In-reply-to: <20230726.112923.27361680552823861.horikyota.ntt@gmail.com> References: <00e24aa6-5d03-99b6-ab41-495a35fc93f6@gmail.com> <982076.1689967306@sss.pgh.pa.us> <5bd4cbfe-fc71-c576-851d-3bb21ef5c080@gmail.com> <20230726.112923.27361680552823861.horikyota.ntt@gmail.com> Comments: In-reply-to Kyotaro Horiguchi message dated "Wed, 26 Jul 2023 11:29:23 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <1821880.1690339317.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Tue, 25 Jul 2023 22:41:57 -0400 Message-ID: <1821881.1690339317@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Kyotaro Horiguchi writes: > At Tue, 25 Jul 2023 13:00:00 +0300, Alexander Lakhin wrote in = >> 21.07.2023 22:21, Tom Lane wrote: >>> There is no inval in the entry-already-present code path in syscache >>> lookup. So if we are seeing this failure, ISTM it must mean that an >>> inval is happening during "close and unlock catalog", which seems like >>> something that we don't want. But I've not traced exactly how that >>> happens. >> Yes, but here we deal with -DCATCACHE_FORCE_RELEASE (added to config_en= v >> on prion), so the cache entry, that was just found in >> SearchSysCacheExists(), is removed immediately because of >> SearchSysCacheExists() ->=C2=A0 ReleaseSysCache(tuple) -> >> ReleaseCatCache(tuple). Oh! So are you saying that this case cannot happen in the wild (that is, in a non-cache-clobbering build)? If so, I think that there's a good case to be made that the cache-clobbering behavior is too strict, and we should change that (not sure just how) rather than complicating callers that are perfectly safe in reality. > Doesn't this imply that the function isn't parallel-safe? The issue is > gone by marking it and all variants as parallel-restricted. As I said earlier, I think that's a purely coincidental "fix" for this specific manifestation. Either SearchSysCacheExists followed by a syscache lookup of the same tuple should be considered safe, or it shouldn't. If it should be considered safe, we need to fix the cache-clobber test scaffolding to not give a false positive. While if it shouldn't, we need to get rid of that coding pattern, not apply high-level band-aids that remove just one particular path to reaching the problem. I'm not dead set on either answer at this point, but I think those are the plausible alternatives. regards, tom lane