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 1rebRa-00CI7C-Is for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Feb 2024 13:54:59 +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 1rebRY-00DotI-NK for pgsql-hackers@arkaria.postgresql.org; Mon, 26 Feb 2024 13:54:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rebRY-00DotA-EA for pgsql-hackers@lists.postgresql.org; Mon, 26 Feb 2024 13:54:56 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rebRT-001Ado-9o for pgsql-hackers@lists.postgresql.org; Mon, 26 Feb 2024 13:54:55 +0000 Received: by mail-pg1-x529.google.com with SMTP id 41be03b00d2f7-5d3907ff128so2674130a12.3 for ; Mon, 26 Feb 2024 05:54:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1708955689; x=1709560489; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=y91xWvIg0z47FcUEgTV/rY/vdvhkwz3uv3jJV4rCOTA=; b=lpkV3gjc6XxTfWZvYK/+DwGZLKBFDOsNso94bFTACmHPYTTwwNkrjwm5Iyd0MROPCo 1b9vxaD8ed7p3NBHCViqOjjMBxciwYF5/m0u8F/OUF09SNijrxowKucH5YNmmWEBytHV N5SQpTKPJQK64/WM0N07avz38PFK0y1eY1rac9t6V+7ynWs4kX8lmfChhdRZDa4/TfeU BKdfIN/8Bm66ovBv1qWNEHgp2KOjQrj9cbK7vH32uyx3AWOnltvszScBZ92iMqUQCJ1j QTId7RJyOlY4I/iNSTK60bh2iZSWDvxOMTPv5WphQTfDKLBufN9ZvuSiRMQvOjHYSqg+ 0/LA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708955689; x=1709560489; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=y91xWvIg0z47FcUEgTV/rY/vdvhkwz3uv3jJV4rCOTA=; b=QExOa99hvPZcdsf35NIdujp4Uid9/87itt8Jir+kh3HyX+H8qxFYjxIBVeUZjnqHE0 kgmsoexZdeamLuTYDngTQ/HOHCi5oa85RDeW3tZtvvp41b9Fyb7+J9s7SBQFqwUo4vtE nLGNWO7Gyue/5AvTKknwKiPw7g3QZTAxaGTWOglOSZbBwc/y5MxuklA9GY5fno4/4VWI XADx9uGtf3mQj5B4B3iaL2eegvcDKsJXs5H7QeM8yiHJoL38kW9Lt4hSU+C9ve9V3J2s KJ7GjgwVwiEo9Hi+O5oEHwbmPxshH0+BoDBxq+6O+9TmG+2ZOBwArkF9cGBy6RNV8IXv jb8g== X-Forwarded-Encrypted: i=1; AJvYcCUYQrsreT+gyZ696CbkeoHe8NuuTpEAai8u6/0mD3I2LCN3l5crLx7TajYk+Btzf7AoIRFTenAvL1bY5O9iIaeZzvjqbcp2a5YSArzcZx/DxBCb X-Gm-Message-State: AOJu0YycJpzSyyIfMeixpMYTGrVDGNkZ1Zz86mdjoMF/T1OjQaZPSvRL 9RJtk3U+QD7BNuz9AGLB4v/y3SL9qb7vlUMi+P8s2e4gvwmhzDHLjGw5j6dL X-Google-Smtp-Source: AGHT+IG0eaJ2j/GYfwrThYim9eIMjIkmAx0EdDyWKcHKTqI7arbC2hI/YvSuQxL//WeFXepnQq3P2g== X-Received: by 2002:a05:6a20:94cd:b0:1a0:ed22:1b7d with SMTP id ht13-20020a056a2094cd00b001a0ed221b7dmr8019180pzb.3.1708955689076; Mon, 26 Feb 2024 05:54:49 -0800 (PST) Received: from jrouhaud ([115.43.41.38]) by smtp.gmail.com with ESMTPSA id j20-20020a634a54000000b005d553239b16sm3901254pgl.20.2024.02.26.05.54.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 05:54:48 -0800 (PST) Date: Mon, 26 Feb 2024 21:54:41 +0800 From: Julien Rouhaud To: Robert Haas Cc: James Coleman , Andres Freund , torikoshia , pgsql-hackers@lists.postgresql.org, =?iso-8859-1?Q?=C9tienne?= BERSAC , ashutosh.bapat.oss@gmail.com, rafaelthca@gmail.com, jian.universality@gmail.com Subject: Re: RFC: Logging plan of the running query Message-ID: References: <20240215185911.v4o6fo444md6a3w7@awork3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Feb 26, 2024 at 01:56:44PM +0530, Robert Haas wrote: > On Sun, Feb 25, 2024 at 5:00 PM Julien Rouhaud wrote: > > Yeah, trying to find a generalized solution seems like worth investing some > > time to avoid having a bunch of CHECK_FOR_XXX() calls scattered in the code a > > few years down the road. > > I just don't really see how to do it. I suspect that every task that > wants to run at some CFIs but not others is going to have slightly > different requirements, and we probably can't foresee what all of > those requirements are. > > Said another way, if in the future we want to call > DoSomethingOrOther() from the CFI handler, well then we need to know > that we're not already in the middle of using any subsystem that > DoSomethingOrOther() might also try to use ... and we also need to > know that we're not in the middle of doing anything that's more > critical than DoSomethingOrOther(). But both of these are likely to > vary in each case. > > EXPLAIN might be one member of a general class of things that require > catalog access (and thus might take locks or lwlocks, access the > catalogs, trigger invalidations, etc.) but it's not clear how general > that class really is. Also, I think if we try to do too many different > kinds of things at CFIs, the whole thing is going to fall apart. > You'll end up failing to foresee some interactions, or the stack will > get too deep, or ... something. I still fail to understand your point. So you say we might want to check for safe condition to run explain or DoSomethingOrOther or even DoMeh, with all different requirements. IIUC what you're saying is that we should have CHECK_FOR_EXPLAIN(), CHECK_FOR_DOSOMETHINGOROTHER() and CHECK_FOR_MEH()? And so in some code path A we could have CHECK_FOR_INTERRUPTS(); CHECK_FOR_EXPLAIN(); In another CHECK_FOR_INTERRUPTS(); CHECK_FOR_DOSOMETHINGOROTHER(); and in one happy path CHECK_FOR_INTERRUPTS(); CHECK_FOR_EXPLAIN(); CHECK_FOR_DOSOMETHINGOROTHER(); CHECK_FOR_MEH(); Or that we should still have all of those but they shouldn't be anywhere close to a CHECK_FOR_INTERRUPTS(), or something totally different? In the first case, I'm not sure why having CHECK_FOR_INTERRUPTS(EXPLAIN|...), with a combination of flags and with the flag handling being done after ProcessIterrupts(), would be any different apart from having less boilerplate lines. Similarly for the 2nd case, but relying on a single more general CHECK_FOR_CONDITION(EXPLAIN | ...) rather than N CHECK_FOR_XXX? If you just want something totally different then sure.