Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.92) (envelope-from ) id 1jIZu5-0000fD-5P for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Mar 2020 15:31:13 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1jIZu4-0002wZ-1e for pgsql-hackers@arkaria.postgresql.org; Sun, 29 Mar 2020 15:31:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1jIZu3-0002uO-Ov for pgsql-hackers@lists.postgresql.org; Sun, 29 Mar 2020 15:31:11 +0000 Received: from mail-wm1-x343.google.com ([2a00:1450:4864:20::343]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1jIZu0-0004H9-O8 for pgsql-hackers@postgresql.org; Sun, 29 Mar 2020 15:31:11 +0000 Received: by mail-wm1-x343.google.com with SMTP id g62so18405154wme.1 for ; Sun, 29 Mar 2020 08:31:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=e0AjBoGZ8d2dX4bWeTvsVztwQzvtwsFb9d6/tf1hjAI=; b=wIX3/J1QsBMZryZCTvEPQrH9KpHkVFn1UNCccv40wCrZcKMkyW1kO7nkFGqNZM1Pdb 46WDRt9exrW8vJqyG6gPiYQB3s1OLLSHUj5pyUNSr2mge5eT97Ys3afqGdn6tZPWuXzJ +OrYdbZnGFmxNfyw2N3hCwpz3WGh+6g1e9Afmu7TG69N+kHJRTIseiVXiYDfssu2Pypt bRCs+H+xyDTrwutcbv50eE91G1sCqLT1/Gh4K5k1mzrHk4wEYQbcKI5tLUKkB4q/Ukrx 0WhVQNHzHSyaoDQSJ7T6w5/ytb3sNo74st5BrXyEA06KXdUW1DluI8Ln/6EARswKlyl+ heOA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=e0AjBoGZ8d2dX4bWeTvsVztwQzvtwsFb9d6/tf1hjAI=; b=IHqUabGyrDN+uEBONyqHk3m1DJt9TO6a6FK9B0OSWCRnA0iycBgmJ99IKXGPxIyz2g 5R0hRzv/wH6VpGocXXxAdC/CN0qTxL1SfbOoIk4x9gxtAgEZuFO1nOKgCIAmCfTtxO4f eX/g206aAGJDf0534y9mLfRRgLCKglumlcxzg0iq3yMwY5xhmQxtTnJ4Wiusp8LR+/04 TxrNywySvTh67ucbyIQ5qmQWRsOpdXwabovZgDXAm0wkm+AVd9+ZDnfyleeAuz4FzdCI H839/TDbvYf9lGnDGp5bx6Fvzi3Cy9R4egY2YmPZ3FQ+Xpnv27SXKKIkxS76cWIxN9ki d4dA== X-Gm-Message-State: ANhLgQ24CN4AKxbVit3QGsygw81RyM+ozZqZCuMoEP+SToSneYcjNYcL fRxfkKS5NHg9cL6EsgWFzSvzTA== X-Google-Smtp-Source: ADFU+vv3hybsg0P8uDuMpLBsuFav/5PFTRnDPyPuLLZ7On2S0qBXBnExfXGUQOeS3vwyNaLDpy0XQg== X-Received: by 2002:a1c:4054:: with SMTP id n81mr8560918wma.114.1585495868175; Sun, 29 Mar 2020 08:31:08 -0700 (PDT) Received: from localhost (ip-86-49-253-141.net.upcbroadband.cz. [86.49.253.141]) by smtp.gmail.com with ESMTPSA id t126sm18264281wmb.27.2020.03.29.08.31.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Mar 2020 08:31:07 -0700 (PDT) Date: Sun, 29 Mar 2020 17:31:05 +0200 From: Tomas Vondra To: Amit Kapila Cc: Dilip Kumar , Michael Paquier , Peter Eisentraut , PostgreSQL Hackers Subject: Re: PATCH: logical_work_mem and logical streaming of large in-progress transactions Message-ID: <20200329153105.mdryxzz562tg65pk@development> References: <20200303214646.6adway2z5wnapjem@development> <20200329005905.ooxq25qyjwn2mvxz@development> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sun, Mar 29, 2020 at 11:19:21AM +0530, Amit Kapila wrote: >On Sun, Mar 29, 2020 at 6:29 AM Tomas Vondra > wrote: >> >> On Sat, Mar 28, 2020 at 03:29:34PM +0530, Amit Kapila wrote: >> >On Sat, Mar 28, 2020 at 2:19 PM Dilip Kumar wrote: >> > >> >How about if instead of writing an XLOG_XACT_ASSIGNMENT WAL, we set a >> >flag in TransactionStateData and then log that as special information >> >whenever we write next WAL record for a new subtransaction? Then >> >during recovery, we can only call ProcArrayApplyXidAssignment when we >> >find that special flag is set in a WAL record. One idea could be to >> >use a flag bit in XLogRecord.xl_info. If that is feasible then the >> >solution can work as it is now, without any overhead or change in the >> >way we maintain KnownAssignedXids. >> > >> >> Ummm, how is that different from what the patch is doing now? I mean, we >> only write the top-level XID for the first WAL record in each subxact, >> right? Or what would be the difference with your approach? >> > >We have to do what the patch is currently doing and additionally, we >will set this flag after PGPROC_MAX_CACHED_SUBXIDS which would allow >us to call ProcArrayApplyXidAssignment during WAL replay only after >PGPROC_MAX_CACHED_SUBXIDS number of subxacts. It will help us in >clearing the KnownAssignedXids at the same time as we do now, so no >additional performance overhead. > Hmmm. So we'd still log assignment twice? Or would we keep just the immediate assignments (embedded into xlog records), and cache the subxids on the replica somehow? regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services