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 1q02sT-0005Sb-Px for pgsql-hackers@arkaria.postgresql.org; Fri, 19 May 2023 16:22:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1q02sS-00059V-0Q for pgsql-hackers@arkaria.postgresql.org; Fri, 19 May 2023 16:22:48 +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 1q02sR-000555-Mt for pgsql-hackers@lists.postgresql.org; Fri, 19 May 2023 16:22:47 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1q02sK-000ktD-9g for pgsql-hackers@lists.postgresql.org; Fri, 19 May 2023 16:22:47 +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 34JGMb0F111412; Fri, 19 May 2023 12:22:37 -0400 From: Tom Lane To: Amit Langote cc: Nathan Bossart , Aleksander Alekseev , PostgreSQL Hackers Subject: Re: The documentation for READ COMMITTED may be incomplete or wrong In-reply-to: References: <3794290.1684421615@sss.pgh.pa.us> <3798164.1684423374@sss.pgh.pa.us> <20230518195123.GA3362715@nathanxps13> <3880859.1684440216@sss.pgh.pa.us> <20230518213442.GA3364784@nathanxps13> <4024583.1684448782@sss.pgh.pa.us> <4111741.1684454234@sss.pgh.pa.us> Comments: In-reply-to Amit Langote message dated "Fri, 19 May 2023 21:53:45 +0900" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <111410.1684513357.1@sss.pgh.pa.us> Content-Transfer-Encoding: 8bit Date: Fri, 19 May 2023 12:22:37 -0400 Message-ID: <111411.1684513357@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Amit Langote writes: > On Fri, May 19, 2023 at 8:57 AM Tom Lane wrote: > + * Initialize per-relation EPQ tuple states. Result relations, if any, > + * get marked as blocked; others as not-fetched. > Would it be helpful to clarify that "blocked" means blocked for a > given EvalPlanQual() cycle? Probably best to put that with the data structure's comments. I changed those to look like /* * relsubs_done[scanrelid - 1] is true if there is no EPQ tuple for this * target relation or it has already been fetched in the current scan of * this target relation within the current EvalPlanQual test. */ bool *relsubs_done; /* * relsubs_blocked[scanrelid - 1] is true if there is no EPQ tuple for * this target relation during the current EvalPlanQual test. We keep * these flags set for all relids listed in resultRelations, but * transiently clear the one for the relation whose tuple is actually * passed to EvalPlanQual(). */ bool *relsubs_blocked; > BTW, I didn't quite understand why EPQ involving resultRelations must > behave in this new way but not the EPQ during LockRows? LockRows doesn't have a bug: it always fills all the EPQ tuple slots it's responsible for, and it doesn't use EvalPlanQual() anyway. In the name of simplicity I kept the behavior exactly the same for callers other than nodeModifyTable. Perhaps replication/logical/worker.c could use a closer look here. It's not entirely clear to me that the EPQ state it sets up is ever used; but if it is I think it is okay as I have it here, because it looks like those invocations always have just one result relation in the plan, so there aren't any "extra" result rels that need to be blocked. regards, tom lane