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 1pSa3Y-0004g7-Ae for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Feb 2023 08:55:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pSa3W-0004Mq-S7 for pgsql-hackers@arkaria.postgresql.org; Thu, 16 Feb 2023 08:55:54 +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 1pSa3W-0004Mb-FX for pgsql-hackers@lists.postgresql.org; Thu, 16 Feb 2023 08:55:54 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pSa3U-0004Sp-AH for pgsql-hackers@postgresql.org; Thu, 16 Feb 2023 08:55:53 +0000 Received: by mail-pj1-x1029.google.com with SMTP id w20-20020a17090a8a1400b00233d7314c1cso5120608pjn.5 for ; Thu, 16 Feb 2023 00:55:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=8TiJD7W5bfaPusg/vKKPxwJGIjPQzfMYq8xY4osW02E=; b=obcbJHtR6reKjLoCDaBX5y8JJuixJw9ayTRwyla8MXscq0kVxYbR+CyjUkUTkuJghl PkERjeDviKuG4w3twc/ggKbgUbU3LEzhItq7Y6IVZxJ25a1EBsQWqHqWyd5BtVHiCuHS 3w3xhrqNjnwbfizViuzc4YSRpJja9Oua3mvh0sAPH0z9eseW1ENQ1S/wbUoohJulGb0Q BlgP5hX2rT3Qntb//49By0TAC7NEfdYSOPTUqQU0BGKPoSgqk5sdU1tmMwRGotzxgD/e JEn1UdFUv18M7fgFR4CDolMFxJ1SdUkO4EGeZkev5AChK9Nuzs7mJGyFee0CO3ceKMNd jkJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=8TiJD7W5bfaPusg/vKKPxwJGIjPQzfMYq8xY4osW02E=; b=pq5D3+IL5hMGzifWh+2d6mb/DbBncmi+1OS8GqhDRQMCFzUTDli3tFxymxxl1sj65F KZsc75OLdpxZIidryMnsSgVdP/nwawJBCCZi87peBve/iwraoNUFI/yUCh6+VrEhINdB 7clDGwfU9/Z37P8AnJKBIsh8qjMvWzLI+n9sTEQb/Ducw8hOztGQYTFoHqMB+1Ex7Jtt MEnhzc+K67z1FZMNf5Wh1UppXPhHl1v44noMwmFAuMblrMo7mrLReRto9PImH6BLOLA7 Dhq/YzvgYImq7jllzYiTRySOOCrZuVaxx390GVUiTysSxVP1eLfNDQizNICR07YBTjkz vcwA== X-Gm-Message-State: AO0yUKVRzFWuaqaAFK+Tr83mxG5PXuqNnhlU3ZvlbPqYsM9AvKV8hwb3 5NV9sYgRya2ZEPMQJIXvHZo= X-Google-Smtp-Source: AK7set/3qLJu0OE0g11Q5hW9VMI0PzsDd5iQGfok3AQGCCGcnNNm5EPQcjpD6UcnWmiRrmptURVZJA== X-Received: by 2002:a05:6a20:3d0b:b0:c0:53f7:7d16 with SMTP id y11-20020a056a203d0b00b000c053f77d16mr6556626pzi.39.1676537751214; Thu, 16 Feb 2023 00:55:51 -0800 (PST) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id n12-20020a62e50c000000b00581f76c1da1sm748199pff.191.2023.02.16.00.55.47 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Thu, 16 Feb 2023 00:55:50 -0800 (PST) Date: Thu, 16 Feb 2023 17:55:46 +0900 (JST) Message-Id: <20230216.175546.98020490115903046.horikyota.ntt@gmail.com> To: kuroda.hayato@fujitsu.com Cc: andres@anarazel.de, amit.kapila16@gmail.com, smithpb2250@gmail.com, shiy.fnst@fujitsu.com, vignesh21@gmail.com, shveta.malik@gmail.com, osumi.takamichi@fujitsu.com, dilipbalaut@gmail.com, euler@eulerto.com, m.melihmutlu@gmail.com, marcos@f10.com.br, pgsql-hackers@postgresql.org Subject: Re: Time delayed LR (WAS Re: logical replication restrictions) From: Kyotaro Horiguchi In-Reply-To: References: <20230216.142101.1198410163394123325.horikyota.ntt@gmail.com> User-Agent: Mew version 6.8 on Emacs 26.1 Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk At Thu, 16 Feb 2023 06:20:23 +0000, "Hayato Kuroda (Fujitsu)" wrote in > Dear Horiguchi-san, > > Thank you for responding! Before modifying patches, I want to confirm something > you said. > > > As Amit-K mentioned, we may need to change the name of the option in > > this version, since the delay mechanism in this version causes a delay > > in sending from publisher than delaying apply on the subscriber side. > > Right, will be changed. > > > I'm not sure why output plugin is involved in the delay mechanism. It > > appears to me that it would be simpler if the delay occurred in > > reorder buffer or logical decoder instead. > > I'm planning to change, but.. Yeah, I don't think we've made up our minds about which way to go yet, so it's a bit too early to work on that. > > Perhaps what I understand > > correctly is that we could delay right before only sending commit > > records in this case. If we delay at publisher end, all changes will > > be sent at once if !streaming, and otherwise, all changes in a > > transaction will be spooled at subscriber end. In any case, apply > > worker won't be holding an active transaction unnecessarily. > > What about parallel case? Latest patch does not reject the combination of parallel > streaming mode and delay. If delay is done at commit and subscriber uses an parallel > apply worker, it may acquire lock for a long time. I didn't looked too closely, but my guess is that transactions are conveyed in spool files in parallel mode, with each file storing a complete transaction. > > Of > > course we need add the mechanism to process keep-alive and status > > report messages. > > Could you share the good way to handle keep-alive and status messages if you have? > If we changed to the decoding layer, it is strange to call walsender function > directly. I'm sorry, but I don't have a concrete idea at the moment. When I read through the last patch, I missed that WalSndDelay is actually a subset of WalSndLoop. Although it can handle keep-alives correctly, I'm not sure we can accept that structure.. > > Those setups work fine when no > > apply-delay involved, but they won't work with the patches we're > > talking about because the subscriber won't respond to the keep-alive > > packets from the peer. So when I wrote "practically works" in the > > last mail, this is what I meant. > > I'm not sure around the part. I think in the latest patch, subscriber can respond > to the keepalive packets from the peer. Also, publisher can respond to the peer. > Could you please tell me if you know a case that publisher or subscriber cannot > respond to the opposite side? Note that if we apply the publisher-side patch, we > don't have to apply subscriber-side patch. Sorry about that again, I missed that part in the last patch as mentioned earlier.. regards. -- Kyotaro Horiguchi NTT Open Source Software Center