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 1rWeas-006WMI-Tv for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Feb 2024 15:39:43 +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 1rWear-006dzA-Hc for pgsql-hackers@arkaria.postgresql.org; Sun, 04 Feb 2024 15:39:41 +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 1rWeap-006dyt-KZ for pgsql-hackers@lists.postgresql.org; Sun, 04 Feb 2024 15:39:41 +0000 Received: from wout5-smtp.messagingengine.com ([64.147.123.21]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rWeah-005R6c-Jl for pgsql-hackers@lists.postgresql.org; Sun, 04 Feb 2024 15:39:39 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.west.internal (Postfix) with ESMTP id 35BD73200A88; Sun, 4 Feb 2024 10:39:27 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute2.internal (MEProxy); Sun, 04 Feb 2024 10:39:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :reply-to:subject:subject:to:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1707061166; x= 1707147566; bh=27Otmudngt3F2EwP+Cr159AidQrSTnNmV8hxyHRAcUg=; b=M LPS8tbsYnOkbE+oFXbuIIXek4eX/izabl7F+mug0OYnMIoEIp9QPeFnU0t7VlMNd AfCRbSXE3BiNr/774k1ev6H+GekmOV+2RBrhs2/eEBz6uy1CCtU/upEhLaTrMGdF NsnQtMTfLF6Tc3uqqO8fsPyCT68Ma7Rjmz9a4SZ0YhhmKeJH8MwJ7bEHHQbheMs0 LaTJb4u8WeLkRPVJGl2rWW3V38Obz8/Y9tsFAVaOP9VW730nnpxIoJzT3+TajmeL dZu7RBwcseYWPxt6I7BVHJYcRFqmJ1CrlXHfwLgZ2hT9LsKyshu9051pVhoaLWBX D8UlWDIso/rU9qhJlAHZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvkedrfedukedgjeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvfevuffkgggtugfgjgesthekredttddtjeenucfhrhhomheptehlvhgr rhhoucfjvghrrhgvrhgruceorghlvhhhvghrrhgvsegrlhhvhhdrnhhoqdhiphdrohhrgh eqnecuggftrfgrthhtvghrnhepvdektdffudfftdffffehfffhjeejhffgieeuueekjeek fffgudffhfduffffueevnecuffhomhgrihhnpegvnhhtvghrphhrihhsvggusgdrtghomh enucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpegrlhhv hhgvrhhrvgesrghlvhhhrdhnohdqihhprdhorhhg X-ME-Proxy: Feedback-ID: ia2694551:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sun, 4 Feb 2024 10:39:24 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alvh.no-ip.org; s=schmee; t=1707061161; bh=VsENHMTeBUFp0hnrz56oeiMNy9YBehgpO5TX4v3y3Bw=; h=Date:From:To:Cc:Subject:In-Reply-To:From; b=kwsYtgvAB75PL5JpmCJ4k9dUhplLqhG4vE5d2xOZqB4QhI9AaT0/z3fJciADBx2eq y4yqeJfwS3GEU6CO59V1RSaeaMFIyRppd9/B9YK+vRdWQWNQHetiszCQPDe+q0pF6v p9mT2LLrbTMZubPP7ZELpb0Q/d8usqZcH5Ivs6qoJjWnOCcQoK3Edh50UoarVEuqYg rYkyUR53D/xOOoSEr5v5Yk53gIVwfdp/7KBJ4tKyIunoHQPt6uEwlaTgSJlwXMKt86 NlXfyXNyb8KxinYjDofMoGuWWnSUjlH/7Eh3urQNE0Aseyc5INMoJMtWcYycr4OE31 Ot6XBldOmCfTQ== Received: by schmee.alvh.no-ip.org (Postfix, from userid 1000) id A3EF5B73; Sun, 4 Feb 2024 16:39:21 +0100 (CET) Date: Sun, 4 Feb 2024 16:39:21 +0100 From: Alvaro Herrera To: Jelte Fennema-Nio Cc: vignesh C , Thomas Munro , Denis Laxalde , Greg Stark , Tom Lane , "Gregory Stark (as CFM)" , Jelte Fennema , Daniel Gustafsson , Peter Eisentraut , Andres Freund , Justin Pryzby , Robert Haas , "pgsql-hackers@lists.postgresql.org" Subject: Re: [EXTERNAL] Re: Add non-blocking version of PQcancel Message-ID: <202402041539.xv5n3pg2x57c@alvherre.pgsql> 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 2024-Feb-02, Jelte Fennema-Nio wrote: > The only reasonable thing I can think of to make that situation better > is to move that part of the function outside of PQcancelPoll and > create a dedicated PQcancelStart function for it. It introduces an > extra function, but it does seem more in line with how we do the > regular connection establishment. Basically you would have code like > this then, which looks quite nice honestly: > > cancelConn = PQcancelConn(conn); > if (!PQcancelStart(cancelConn)) > pg_fatal("bad cancel connection: %s", PQcancelErrorMessage(cancelConn)); > while (true) > { > // polling using PQcancelPoll here > } Maybe this is okay? I'll have a look at the whole final situation more carefully later; or if somebody else wants to share an opinion, please do so. In the meantime I pushed your 0002 and 0003 patches, so you can take this as an opportunity to rebase the remaining ones. -- Álvaro Herrera PostgreSQL Developer — https://www.EnterpriseDB.com/ "The saddest aspect of life right now is that science gathers knowledge faster than society gathers wisdom." (Isaac Asimov)