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 1sqnH1-00CqyR-5g for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Sep 2024 05:30:44 +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 1sqnH0-003t9U-Ob for pgsql-bugs@arkaria.postgresql.org; Wed, 18 Sep 2024 05:30:42 +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 1sqnH0-003t8I-G8 for pgsql-bugs@lists.postgresql.org; Wed, 18 Sep 2024 05:30:42 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sqnGx-001kn7-MV for pgsql-bugs@lists.postgresql.org; Wed, 18 Sep 2024 05:30:41 +0000 Received: by mail-pl1-x635.google.com with SMTP id d9443c01a7336-2059112f0a7so46968435ad.3 for ; Tue, 17 Sep 2024 22:30:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1726637439; x=1727242239; darn=lists.postgresql.org; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=9WhCOGEuM9AR2EWLPv2ZijZCZK2k7e5zEbk9aJIgoAU=; b=cVZE5/OPZ/ZEZQwK912FlJpYHTat1/NjSD7wYwO4y1A6qeVLXGJdfWuuqvW2i5mTQg DQ4oEjPZAEVQ4w1e6rJgR+7JCJmjl9ZhsbNcyMSex0bIuu3u0CB3/iib+05FoxYTZs5/ UHtDh9fPQiuKX7ghAFVQL2mrMiZ5EgCgLUMps= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726637439; x=1727242239; h=user-agent:in-reply-to: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=9WhCOGEuM9AR2EWLPv2ZijZCZK2k7e5zEbk9aJIgoAU=; b=O7RTl39ztjvwTa4BNqQCLwb5WLDOMAQ6Jbx8BlWxyzmWSDxXb//gFB+5qIOK64PFrC n9U5dZojHKLTnY9QNRhBb9J/k72jeFbhX0hscfUt5GW5DecdMWZWE5OYuwH/0Be235yz AKLFcalVp2J0Z7+nTgG/2/J6Xu1w2HRY+mf5qNCRkc6nyvRqFpVet+d4sVkvEqCfAvkS lO/7azhA5MomdesHxP6mXJo4hMo/oB71hzYrxg8eSY/RdMxM3HcE14AMFH7R+40U9/yZ i1IDjVm1/hbuzoeK9+hkiqXjDtKjJlkxhMsnI9czwdFWbcpW7/mj+kBqQHhymyY1NRRA mXeA== X-Forwarded-Encrypted: i=1; AJvYcCVRhTlaGdUMNHFKGv7IFAYZygpNUEkGBLQkABy/43jWeJKpVQ9c4N4DcOSDTTu8J1Yf2+rXFvr47iNB@lists.postgresql.org X-Gm-Message-State: AOJu0YyQbNaGLNwLUGgqAzjRnsS+YPeD4chqPZMiccyOpap3UzOhISm5 SHia30kwfnrpGhjIZhOlJmcmIVSBIEc0TlD5PRIQf1R0ten5vDGScX6y39kipw== X-Google-Smtp-Source: AGHT+IGMSCaFp9/Q0yLH13E1LRYGkUevuuRfZeUAtctub2QbRgeZHiF5sKBD2ZwrTCLJBglsKXYqFw== X-Received: by 2002:a17:902:e80e:b0:205:4721:19c with SMTP id d9443c01a7336-20782be4db8mr269481055ad.37.1726637438703; Tue, 17 Sep 2024 22:30:38 -0700 (PDT) Received: from google.com (108-233-125-46.lightspeed.sntcca.sbcglobal.net. [108.233.125.46]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-207946032b9sm58200365ad.116.2024.09.17.22.30.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 17 Sep 2024 22:30:38 -0700 (PDT) Date: Tue, 17 Sep 2024 22:30:26 -0700 From: Noah Misch To: Tom Lane Cc: Francesco Degrassi , pgsql-bugs@lists.postgresql.org Subject: Re: Leader backend hang on IPC/ParallelFinish when LWLock held at parallel query start Message-ID: <20240918053026.79.nmisch@google.com> References: <20240918030159.2a.nmisch@google.com> <1737570.1726633422@sss.pgh.pa.us> <20240918050434.13.nmisch@google.com> <1744648.1726636728@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1744648.1726636728@sss.pgh.pa.us> User-Agent: Mutt/2.2.12 (2023-09-09) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Sep 18, 2024 at 01:18:48AM -0400, Tom Lane wrote: > Noah Misch writes: > > On Wed, Sep 18, 2024 at 12:23:42AM -0400, Tom Lane wrote: > >> I actually think that the problem is somewhere upstream of here: > >> what in the world are we doing invoking planning and execution of > >> arbitrary queries in a context where interrupts are held off? > > > It would be nice to never run planning or execution with interrupts held. The > > concrete examples so far involve btree operator classes with non-C support > > functions. How practical would it be to release buffer content locks before > > running index support functions? > > Ugh. Probably not very. We have to be able to perform comparison > operations within the scanning of a page. Even if it could be made > to work correctly to release and re-acquire the buffer lock many > times per page, it sounds awful for performance. Sounds that way. > > An alternative would be blocking non-C > > support functions (and instructing C support function authors to not use > > planner/executor). Non-C support functions have been handy for testing if > > nothing else, though. Do non-bundled modules rely on non-C support functions? > > Dunno ... but the OP claimed this is a case that's seen in the > field, so maybe somebody is doing it. On the whole I don't see > how a btree support function can be considered not to be a low-level > thing, so maybe restricting what it can do is the best answer. > I fear though that the restriction can't simply be to forbid > parallel sub-queries. > > On the third hand: you can't implement a btree comparison function > in SQL and simultaneously claim with a straight face that you > expect premium performance. Could we set things up so that > buffer release/reacquires happen only with non-C support functions? > This still requires that such behavior is safe in the face of > concurrent index activity, which I'm not sure is practical. > (Also, I'm not sure to what extent we'd still be testing what > we wish to with test comparison functions written in SQL.) Not to rule it out yet, but your point about reduced test fidelity is cause for hesitation. Also, I'd regret even having that code bloating up a btree hot path. What if we just ignored the plancache when uninterruptible? The new planner check would then suffice. If it slows anything folks care about, either find a way to become interruptible or make a C function that bypasses planner & executor.