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 1pthSN-0004ce-CN for pgsql-hackers@arkaria.postgresql.org; Tue, 02 May 2023 04:17:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pthRM-00051L-OZ for pgsql-hackers@arkaria.postgresql.org; Tue, 02 May 2023 04:16:36 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pthRM-00051C-7u for pgsql-hackers@lists.postgresql.org; Tue, 02 May 2023 04:16:36 +0000 Received: from mail-oa1-x2e.google.com ([2001:4860:4864:20::2e]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pthRJ-0003a2-Sp for pgsql-hackers@lists.postgresql.org; Tue, 02 May 2023 04:16:35 +0000 Received: by mail-oa1-x2e.google.com with SMTP id 586e51a60fabf-1928860f63eso69516fac.0 for ; Mon, 01 May 2023 21:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683000993; x=1685592993; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=gFFPgf6ORf+Js10d/K0+sdTiLFqrxcIjFXygm83+rK8=; b=jeYLmwWHcCzbJrlYvPbYIG114lUgjBvQ+HuIgqNkVnJm2xP91oN3oAx7pNTwF6clcn XHAOtVAKocn8bpwkGdfuXaFZF5T4rB6DvxeAiFgouTVmPevuoFgVPY1J6oz3jHRNLJNi Qplfp5WNusJguEjt3vJSQt+wi1//Q/HIf56LG/4rLzquKW5Qn5CgwY0NTfoWx3b7f3OO aCLbHXNHrmMKyTgLnav1X15OgZVK2lBQcJewfG+f1N40lzAZXTLTSd2g9eNfeo3raY+2 52emUzi4BXz7yvCZM1BH9zB8VzXgQX3gPzZ2yRllWwOIO/7PPyQGN3DoEThQpfOSF7lT MxDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683000993; x=1685592993; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gFFPgf6ORf+Js10d/K0+sdTiLFqrxcIjFXygm83+rK8=; b=Tq8J0ZvpSKxz13kyPqZwdQZwQ+qz/KWbmr+mokYLcToTfTC4ZsB3Gk4h5Mz6PZwnBT smV5TuS9pa1oFlHO84RvRMaBw0u77IyQVIJyX/Os+ZGET1SULtdPfVzNSDncyV36efJa +pZWPwP0FrARzo9b9Q0rzHdqEiVR178jrTGWweXypMesFpVJTeMP7Xgh8Z4xaHCpMKt5 6q5+OBTlkvSilvCxfQOPlcE8/mxUhqpW4I15/Iq/k312orRP+HQ8QiF9RpTbQVA4J3ZT N8QLgg0nEn3MJKrEDH1Xlg1oA77dpziCdfW5HWLLlSgTNGaVuLcs4aIbYOtFK6ovZuUl 0xMA== X-Gm-Message-State: AC+VfDyJXdG18aLxLGCJYdQiB0WcBDLEMfSuL7XzC/4gaKdXEv/CJKpc A1boKQkI0WGWiHOpG+LzDTpj1R7IARxiLIeDvJA= X-Google-Smtp-Source: ACHHUZ4/92HRzbJaQp8g5XYFQUp8tkFRGfBl3ncmQLk7PsqcWmzrLy+T56T1/4IDPtKKJcH8SzJDsFYdmFPJQWdqHNA= X-Received: by 2002:a05:6808:64a:b0:38e:e022:7a02 with SMTP id z10-20020a056808064a00b0038ee0227a02mr6949358oih.10.1683000993135; Mon, 01 May 2023 21:16:33 -0700 (PDT) MIME-Version: 1.0 References: <2185d65f-5aae-3efa-c48f-fb42b173ef5c@gmail.com> In-Reply-To: From: Amit Kapila Date: Tue, 2 May 2023 09:46:21 +0530 Message-ID: Subject: Re: Perform streaming logical transactions by background workers and parallel apply To: "Zhijie Hou (Fujitsu)" Cc: Masahiko Sawada , Alexander Lakhin , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Tue, May 2, 2023 at 9:06=E2=80=AFAM Zhijie Hou (Fujitsu) wrote: > > On Friday, April 28, 2023 2:18 PM Masahiko Sawada = wrote: > > > > > > > > Alexander, does the proposed patch fix the problem you are facing? > > > Sawada-San, and others, do you see any better way to fix it than what > > > has been proposed? > > > > I'm concerned that the idea of relying on IsNormalProcessingMode() > > might not be robust since if we change the meaning of > > IsNormalProcessingMode() some day it would silently break again. So I > > prefer using something like InitializingApplyWorker, or another idea > > would be to do cleanup work (e.g., fileset deletion and lock release) > > in a separate callback that is registered after connecting to the > > database. > > Thanks for the review. I agree that it=E2=80=99s better to use a new vari= able here. > Attach the patch for the same. > + * + * However, if the worker is being initialized, there is no need to releas= e + * locks. */ - LockReleaseAll(DEFAULT_LOCKMETHOD, true); + if (!InitializingApplyWorker) + LockReleaseAll(DEFAULT_LOCKMETHOD, true); Can we slightly reword this comment as: "The locks will be acquired once the worker is initialized."? --=20 With Regards, Amit Kapila.