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 1pu6jw-00087M-1H for pgsql-hackers@arkaria.postgresql.org; Wed, 03 May 2023 07:17:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pu6ju-0001r7-Rs for pgsql-hackers@arkaria.postgresql.org; Wed, 03 May 2023 07:17:26 +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 1pu6ju-0001qx-It for pgsql-hackers@lists.postgresql.org; Wed, 03 May 2023 07:17:26 +0000 Received: from mail-ot1-x335.google.com ([2607:f8b0:4864:20::335]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1pu6jn-000GNu-UG for pgsql-hackers@lists.postgresql.org; Wed, 03 May 2023 07:17:25 +0000 Received: by mail-ot1-x335.google.com with SMTP id 46e09a7af769-6a5d9853d97so1900168a34.2 for ; Wed, 03 May 2023 00:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683098239; x=1685690239; 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=DY0hTSc8En/QoqEFs/l2oyLmdrzHaS8lZkE+mveHEIk=; b=mcKcLkrvsyr6uuKMn6rOff4haVoYNhgp+MiJh6R3vtPj1sdrl3tdEgwy4olxvfgIPf XGOtQvWFywa/aoA9S+dZ/ofA4uMlD1cUiZWam79dTKcJ32PyADulEAoFh+TftlMCPx0V yHkThRbbqQ99967y5SgQBcFXmeSA+kDy/lGyhryrqEtXR3A/3WgY4qkXgA3YM6VY5t4w mBNEJOU931ZbkJjRmvA3JAyTN1ruGbhLMU8qiHcAi3nzpX3d34/PMCFw6sQKCss025Ad uKNluqXEnW2hye3f20keObSFRbLt52JITXmb1Wis36P6rAvbwQaOdEBjAq5TCYURPESc jEMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683098239; x=1685690239; 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=DY0hTSc8En/QoqEFs/l2oyLmdrzHaS8lZkE+mveHEIk=; b=D3lSjJb6x1MazYUxhpuILkfiSqVjd3wVrS+vLoRhGn7LYe0UJbcR+wTsDIyMd+v9sQ CB9e4o/wQqBb9RotGKa2EQl48nYZ+R8rQXhZO3zNPud6OincvvrVVqvAcsaXT0/yEkIA +wB8EKZHiv3sP5fKv/3WynrB9DlTijmnpxG15PAJEURZpIq7zJgJS6nQ9v91MHEcjTBC FNSz+lUAXUpudR7MgM3ShCYnOv1MHAlB10/xlovbd5/SFPgRRXZhnN9t4NkaVTHilYmP QrXamizlqLw2dswifzSxE8bm533Uc6EwBghm3FtD7qqzT6nQ/VYsYXQ71YKflElLey+y 9fUg== X-Gm-Message-State: AC+VfDx/gqpgeqWmxidYEjwngEzTtLtLXEr+A57OvTpg8kougfNwFnZB 71fz0IK0FaaBTOf1M5E93T6YyuuDhtwuigckt7w= X-Google-Smtp-Source: ACHHUZ6wJZaAs8rnmdObwNJhT2zFixrMdavu16s8+n0XmJPXT4Nec5sJEt/4lNq32+lRGMnG5IXk/rEeR4rFh6qB3pY= X-Received: by 2002:a05:6870:6249:b0:187:9dfd:87cf with SMTP id r9-20020a056870624900b001879dfd87cfmr8855182oak.37.1683098238573; Wed, 03 May 2023 00:17:18 -0700 (PDT) MIME-Version: 1.0 References: <2185d65f-5aae-3efa-c48f-fb42b173ef5c@gmail.com> In-Reply-To: From: Amit Kapila Date: Wed, 3 May 2023 12:47:06 +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:46=E2=80=AFAM Amit Kapila wrote: > > 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 wh= at > > > > 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 va= riable here. > > Attach the patch for the same. > > > > + * > + * However, if the worker is being initialized, there is no need to rele= ase > + * 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."? > After making this modification, I pushed your patch. Thanks! --=20 With Regards, Amit Kapila.