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 1ts9L9-00Ft2X-HO for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Mar 2025 23:48:51 +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 1ts9L5-009cxA-OD for pgsql-hackers@arkaria.postgresql.org; Tue, 11 Mar 2025 23:48:47 +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 1ts9L5-009cx2-Dz for pgsql-hackers@lists.postgresql.org; Tue, 11 Mar 2025 23:48:47 +0000 Received: from mail-ot1-x329.google.com ([2607:f8b0:4864:20::329]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1ts9L1-002Khp-1T for pgsql-hackers@postgresql.org; Tue, 11 Mar 2025 23:48:46 +0000 Received: by mail-ot1-x329.google.com with SMTP id 46e09a7af769-728a433ec30so4908690a34.1 for ; Tue, 11 Mar 2025 16:48:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=leadboat.com; s=google; t=1741736923; x=1742341723; darn=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=Shqd+9Of12zQyjeEwVULxdbTi2aGJy7lUM9LPJ2kcC8=; b=GHxZIsTtQfv/UrxnI/8PG9VyCJWvORoPep2TAeYdQa6Wqoij9CoNhXs8LNYfpLxUo7 x3yeI1C7eo78R9MgZOa71xsDBGdWwW2lKeqbyYqjXBkWFCXJxacP7uYC9F1Q1/Uwbana Yg0rO+wbDOBQpvdfqjoLAe4u5oBh1USxjV/Cw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741736923; x=1742341723; 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=Shqd+9Of12zQyjeEwVULxdbTi2aGJy7lUM9LPJ2kcC8=; b=E4owigz/xL/i1Nve88Lq5QjkbFyVHqxY4GwP6zaZz2VPrO+4ql27aFwmEuB9DvaB8Z dOopbLHtvHhHIXKDAmJEXuHziUwXysEpa03U4ZspC6WowBWek9HLQXch/gTycfOqbWxP EbakZybwY9P0i/78fMpV/AKAx3PKhhcrrEJUzgUa1UG7+VYrnNAMZjzuYPTyUW5ZRiGL ZhfOq3kJUYsM+FNvyk0zkMZFZdVTquPepIY3zuAC7P62r7JmRzF34UGT/2PlnwK8OQV2 /ZUBv94SesBbyJEN/ftNPqlflbcyl5WevwP3GHSDYz6svKN430Nl+7P51ezDZRaFf/Ux YVCA== X-Gm-Message-State: AOJu0Yz7bZK1NLb9hPu6qT0zcG/teBgBrTHEMBPXBGdVa6b57kINaO41 49urDu3cwmirTPSbbne1lUivYFEREVSyCToGJqfOV/YdLo4OTJcKvaLhwdOi5R/4CVcvhGSMHJU = X-Gm-Gg: ASbGnctXHs4SDTOLLF9835v3BwflE2boZZnD3B4QdVflqf092Qi+2ypbhOqk0xzQrzf o0IhkI4CBlr0YAVDilTUhu31oMpvIBYq/N7vgs5gJ3ElCc7KBVg9iwtSRFMimRRbvIq6gDKm4dn 6b8Ux13ELbyzTMpfFcoeGD4oQZPuwh/StSVa1V0YCzA2RvHU5U7bfgi4jO1t3N5chUuJaGuVCdM aKbaJkj5F461gQLhCMN33CkmcIAkodXugpeELQeima+kh58RmPdHcXBlRRjpyO4LArGUzQ5SUwe pgIrb7trGMk0+GUjjqYQq93KvF86rb4Nqd+Kz0M= X-Google-Smtp-Source: AGHT+IFBN1bPUxVPwtpQIh7jk4kUb279TUQnW3WQobNDd97tijnJ5tficneG+dpOrY0EhBvNnqLSnA== X-Received: by 2002:a05:6830:2584:b0:72b:a06b:dd71 with SMTP id 46e09a7af769-72ba06be02amr1909570a34.5.1741736922513; Tue, 11 Mar 2025 16:48:42 -0700 (PDT) Received: from google.com ([2600:1702:a20:5750::46]) by smtp.gmail.com with ESMTPSA id 46e09a7af769-72ba17540a8sm300821a34.64.2025.03.11.16.48.41 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 11 Mar 2025 16:48:41 -0700 (PDT) Date: Tue, 11 Mar 2025 16:48:39 -0700 From: Noah Misch To: Andreas Karlsson Cc: pgsql-hackers@postgresql.org Subject: Re: dblink query interruptibility Message-ID: <20250311234839.9c.nmisch@google.com> References: <20231122012945.74@rfd.leadboat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Thu, Mar 06, 2025 at 02:57:01PM +0100, Andreas Karlsson wrote: > On 11/22/23 2:29 AM, Noah Misch wrote: > > Something as simple as the following doesn't respond to cancellation. In > > v15+, any DROP DATABASE will hang as long as it's running: > One of our customers ran into this bug when upgrading from PostgreSQL 14 to > PostgreSQL 16. Your commit[1] fixed this issue in PostgreSQL 17 but the > bugfix was not backported with the explanation below. > > > Code inspection identified the bug at least thirteen years ago, but user > complaints have not appeared. Hence, no back-patch for now. > > But that is as far as I can tell not the case because at least for CREATE > DATABASE the bug was introduced in a commit[2] in PostgeSQL 15. > 1. https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=d3c5f37dd543498cc7c678815d3921823beec9e9 > 2. https://git.postgresql.org/gitweb/?p=postgresql.git;a=commitdiff;h=e2f65f42555ff531c6d7c8f151526b4ef7c016f8 The CREATE DATABASE hang is indeed new in v15. The general dblink missed interrupt processing (e.g. pg_cancel_backend response delay) is an old bug. > And now that > we actually have a user complaint what do you think about backporting the > fix? Yes, that seems fine to do. No PGXN module refers to libpq-be-fe-helpers.h so I'm unconcerned about a compatibility risk from adding it. In the context of https://github.com/2ndQuadrant/pglogical/pull/454, I did test the functions against all versions v9.4+. Commit d3c5f37 used the new functions for postgres_fdw, not just dblink. That caused message changes detailed in postgr.es/m/CAHGQGwGpDTXeg8K1oTmDv9nankaKTrCD-XW-tnkzo6%3DE9p5%3Duw%40mail.gmail.com so I'm inclined to omit postgres_fdw changes in back branches. postgres_fdw was already interruptible, so the point of making postgres_fdw adopt the functions was to reduce code duplication. Overall, in the absence of objections, I will queue a task to back-patch the non-postgres_fdw portion of commit d3c5f37 to v13-v16.