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 1p8YcU-0005iR-28 for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Dec 2022 03:21:14 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1p8YcS-0005WT-IK for pgsql-hackers@arkaria.postgresql.org; Fri, 23 Dec 2022 03:21:12 +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 1p8YcS-0005WK-7m for pgsql-hackers@lists.postgresql.org; Fri, 23 Dec 2022 03:21:12 +0000 Received: from mail-yb1-xb32.google.com ([2607:f8b0:4864:20::b32]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1p8YcQ-0003S1-2V for pgsql-hackers@lists.postgresql.org; Fri, 23 Dec 2022 03:21:11 +0000 Received: by mail-yb1-xb32.google.com with SMTP id v126so4089615ybv.2 for ; Thu, 22 Dec 2022 19:21:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=1PJ+0u1TNONCAdTPmrjudjm/2Op5/OoTk9qcyf6s2L8=; b=h0LCuhWXsxcGvkHKntjULFPNdYgDhRnVDzCmtMDVQfn951yIEQ/F0DUEPzd/9MwG3S rA3AigwJNfI1vbj8E7HUu7dDIJ1H5WSXrmtGvvORVJqahtxrDP/3YW+c9TaJJuFIk5G6 syLE7wtaaXDesTvn9xEAuj/J1HCncASwch8AKXGS2hjNUi7kw+fHy3keWNFUP+s8yBLN EW8HYm/wWTuEaaZiHdMFnSjNaSHcsuoWvxBUfZXZ+ADflzlu2/cDcM/TxAM9PnIlp/zN G5sSLjFYH5UbyCMWIfxvPU8V5spK6fBawuEr7LY63orlpHo1En7qGDSlBBtHZN0eel9J 2EWw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=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=1PJ+0u1TNONCAdTPmrjudjm/2Op5/OoTk9qcyf6s2L8=; b=pufSfIwc8KI2XzL0JeAIuC5252+K2o8V58KJIfArVrL60ZfHZpaW2tNX8HwS6NEwkh UJtzXWx+ghbNJc09+LUOS496N0YXeWqJ03N1DDVNK5KU6U3Y1vTu27oySCLzHnB9I70G F7zNCkz0oZqxkS8dhkwkfs+MiXsFQ/ovFuxEN6uO7qWKxvAYX0jZx9PrLKhyobXYIsAN vroaHp0beBsxsyPKj22JDI1TSdO2Hu0OlXTJuqJzgIIYTu1sTTT7GL6A/H9xN+8d8gto nBNhfNginEqHcR+rFL47Fkz7FJqLChfMWu2/xpIr+Gh2Srh7WD/MPaIWAyI75UR84mTw 0hmA== X-Gm-Message-State: AFqh2koPxOZd8hXBxVDU34SY8ECzeWerZd0k5fJzOCUU9yic+2CbklhV 4H+0c3SV25ITPJA5NuOKimuPEtdYxFVMXTVoXL8= X-Google-Smtp-Source: AMrXdXvKC06LPtOrKf3Mux709k9HBidnso4F63DiNIIQHXqGOxYpz7WPzO4QZvOuWYGShu1gYswEIGZJSktkG8OPTds= X-Received: by 2002:a25:3d01:0:b0:6f4:bd2a:12de with SMTP id k1-20020a253d01000000b006f4bd2a12demr950070yba.317.1671765668021; Thu, 22 Dec 2022 19:21:08 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Amit Kapila Date: Fri, 23 Dec 2022 08:50:58 +0530 Message-ID: Subject: Re: Perform streaming logical transactions by background workers and parallel apply To: Masahiko Sawada Cc: "houzj.fnst@fujitsu.com" , Peter Smith , "wangw.fnst@fujitsu.com" , Dilip Kumar , "shiy.fnst@fujitsu.com" , PostgreSQL Hackers Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Dec 22, 2022 at 6:18 PM Masahiko Sawada wrote: > > On Thu, Dec 22, 2022 at 7:04 PM Amit Kapila wrote: > > > > On Thu, Dec 22, 2022 at 11:39 AM Masahiko Sawada wrote: > > > > > > Thank you for updating the patch. Here are some comments on v64 patches: > > > > > > While testing the patch, I realized that if all streamed transactions > > > are handled by parallel workers, there is no chance for the leader to > > > call maybe_reread_subscription() except for when waiting for the next > > > message. Due to this, the leader didn't stop for a while even if the > > > subscription gets disabled. It's an extreme case since my test was > > > that pgbench runs 30 concurrent transactions and logical_decoding_mode > > > = 'immediate', but we might want to make sure to call > > > maybe_reread_subscription() at least after committing/preparing a > > > transaction. > > > > > > > Won't it be better to call it only if we handle the transaction by the > > parallel worker? > > Agreed. And we won't need to do that after handling stream_prepare as > we don't do that now. > I think we do this for both prepare and non-prepare cases via begin_replication_step(). Here, in both cases, as the changes are sent to the parallel apply worker, we missed in both cases. So, I think it is better to do in both cases. > > > > It seems currently we give a similar message when the logical > > replication worker slots are finished "out of logical replication > > worker slots" or when we are not able to register background workers > > "out of background worker slots". Now, OTOH, when we exceed the limit > > of sync workers "max_sync_workers_per_subscription", we don't display > > any message. Personally, I think if any user has used the streaming > > option as "parallel" she wants all large transactions to be performed > > in parallel and if the system is not able to deal with it, displaying > > a LOG message will be useful for users. This is because the > > performance difference for large transactions between parallel and > > non-parallel is big (30-40%) and it is better for users to know as > > soon as possible instead of expecting them to run some monitoring > > query to notice the same. > > I see your point. But looking at other parallel features such as > parallel queries, parallel vacuum and parallel index creation, we > don't give such messages even if the number of parallel workers > actually launched is lower than the ideal. They also bring a big > performance benefit. > Fair enough. Let's remove this LOG message. -- With Regards, Amit Kapila.