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 1noKnB-0004Rn-NQ for pgsql-hackers@arkaria.postgresql.org; Tue, 10 May 2022 08:00:25 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1noKnA-0006zw-El for pgsql-hackers@arkaria.postgresql.org; Tue, 10 May 2022 08:00:24 +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 1noKnA-0006zn-2a for pgsql-hackers@lists.postgresql.org; Tue, 10 May 2022 08:00:24 +0000 Received: from mail-pg1-x52d.google.com ([2607:f8b0:4864:20::52d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1noKmz-0005Pn-Oi for pgsql-hackers@lists.postgresql.org; Tue, 10 May 2022 08:00:23 +0000 Received: by mail-pg1-x52d.google.com with SMTP id e5so14014920pgc.5 for ; Tue, 10 May 2022 01:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=CKKqW30hdKIrKmz9Ob/0mpLKfk7Wxeq8bCNUD7MTRkU=; b=XAEKBcQnToRzqNJkxa6RJyyW9vKV9rIVXrMtbEDg05twqKGnLSodVwhEgWeBuJhQaC cZzfttCnyhVK7mhfxkR2AY3WZ8a/CCzkrEexfuj2QH0/Qwh7PWceh9Ga8de4OKlTs77A Rgo7xgyUiCsBI7j9iI8f4tdw3XsAXL9Dx4Xa68njScL0yAo8Y93RpmU632EnxF+Zt2/S v6EpWVy/HIE6sYXnlXZb1dpslFEny2WTKhUbYEEH9hfQWZxV/hD9CsEYvJJ3gTmcXUcn yCaDg4Odz4zEY8enLLJvrbkLYVaFwRS5nOJOpoTxWi9Z1sAbnOR+oXAx/4arR+SukXL7 Is0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=CKKqW30hdKIrKmz9Ob/0mpLKfk7Wxeq8bCNUD7MTRkU=; b=oi7Auh1GdEGnhQ91T8wXV6aW8zRqoQqnPhWmN04jSJRc6BNzcvZH6Nu01o/R62Jx7B B0KqlYnZ+PrxCc4mwQZJcz056WStWRsE5mV6q3KLyJfjFGnVKcj3bg6edZRruQDdcXQc k7UR30D1g5Nvayy2LAwSVuVfeBVmn7NqMyWdiH3Rvf3dwGa3FmigiLAUGik6Gyq7jTE6 VEqNgeU6qg7mIWTkXbCqNc7coqJIMuKusFag9m5gxJpXG445MytCjfe629BFlUQJRmoF LDlTriu5yLN1huGYU/e0XeI7mLteZWPDCGk7XEdIRob4MLc2xsmKjIR37BTLIQHJE5+o 9FeQ== X-Gm-Message-State: AOAM530sVx/fQrnjgAtvvGiB8ZRwwtLFJ9eA8ijwP66bEnylQMR1vn2b PlHcxoiLX/bDKvfO1r4S/tBfmPGU9s7NE1giFEcm4araQQE= X-Google-Smtp-Source: ABdhPJz3OoPsbQmGI9nu7WZk3tOh4CXaBe4XSDUVzo9nzSBdTqiaysXPEpyRQoRZy1tc1H2Nd0l/7vvL4X/L9iLG8UM= X-Received: by 2002:a05:6a00:1683:b0:4f7:e497:6a55 with SMTP id k3-20020a056a00168300b004f7e4976a55mr19325761pfc.21.1652169611402; Tue, 10 May 2022 01:00:11 -0700 (PDT) MIME-Version: 1.0 References: <9290b55b6ae2b04e002ca9dadadd1cca09461482.camel@cybertec.at> <763B5AF0-1C9E-4796-9639-F969A2E66189@yandex-team.ru> In-Reply-To: From: Bharath Rupireddy Date: Tue, 10 May 2022 13:29:59 +0530 Message-ID: Subject: Re: An attempt to avoid locally-committed-but-not-replicated-to-standby-transactions in synchronous replication To: Dilip Kumar Cc: Andrey Borodin , Laurenz Albe , PostgreSQL Hackers , SATYANARAYANA NARLAPURAM Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, May 10, 2022 at 1:18 PM Dilip Kumar wrote: > > On Mon, May 9, 2022 at 4:39 PM Andrey Borodin wrote: > > > > On 9 May 2022, at 14:44, Dilip Kumar wrote: > > > > > > IMHO, making it wait for some amount of time, based on GUC is not a > > > complete solution. It is just a hack to avoid the problem in some > > > cases. > > > > Disallowing cancelation of locally committed transactions is not a hack. It's removing of a hack that was erroneously installed to make backend responsible to Ctrl+C (or client side statement timeout). > > I might be missing something but based on my understanding the > approach is not disallowing the query cancellation but it is just > adding the configuration for how much to delay before canceling the > query. That's the reason I mentioned that this is not a guarenteed > solution. I mean with this configuration value also you can not avoid > problems in all the cases, right? Yes Dilip, the proposed GUC in v1 patch doesn't allow waiting forever for sync repl ack, in other words, doesn't allow blocking the pending query cancels or proc die interrupts forever. The backends may linger in case repl ack isn't received or sync replicas aren't reachable? Users may have to set the GUC to a 'reasonable value'. If okay, I can make the GUC behave this way - value 0 existing behaviour i.e. no wait for sync repl ack, just process query cancels and proc die interrupts immediately; value -1 wait unboundedly for the ack; value > 0 wait for specified milliseconds for the ack. Regards, Bharath Rupireddy.