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.89) (envelope-from ) id 1ikvZ5-0006LK-Fr for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2019 19:46:27 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ikvZ3-0004pp-IJ for pgsql-hackers@arkaria.postgresql.org; Fri, 27 Dec 2019 19:46:25 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1ikvZ3-0004ph-5s for pgsql-hackers@lists.postgresql.org; Fri, 27 Dec 2019 19:46:25 +0000 Received: from mail-pl1-x643.google.com ([2607:f8b0:4864:20::643]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ikvZ0-0005Wd-Rc for pgsql-hackers@postgresql.org; Fri, 27 Dec 2019 19:46:24 +0000 Received: by mail-pl1-x643.google.com with SMTP id g6so9142102plp.6 for ; Fri, 27 Dec 2019 11:46:22 -0800 (PST) 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:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=+tGN1PAaM081XsuJsdIjJYafzDUPLqb7BFePMoiZUxY=; b=W8F6w1xaFOWsQxSAuzScMPEBfYdNwCf0xIKZIwETSYCotWgfbzSwV22M6iaWBh2rB8 jAHPcc8/wGmJV8MTIpC8/xBL56d104fq9eUZCsh/mfkXLX1iJprDiCw9/H373fEn5Dzd 8Wo2SzGcNjGFMuJUzayyA60gYkOYZbtV2hM/FYqbdOHWdH5bhDVV7Mw/51fTo1U0kBI/ HKt465L2q++7dKJW3BcSPnoKsdR/LYu2JrQqT5Tt8dFUzyQqbNAmAYWHInzqMwrmPNZI 0Ve2joMg1TO1FviTOE1DYpVIIArMpcCaqdsWgNA5O9IpiPVUR7uyfwnxmDyIDZDf7qug Bpkw== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=+tGN1PAaM081XsuJsdIjJYafzDUPLqb7BFePMoiZUxY=; b=A9rRVZ3D3OYgmoBV0NTKtifoutnI1EivonkMUIkXT5wfZZc3RcMU0CWNb7UxKNcGRy 730AlNEJmDxOFmHWmRfNUWs8KjsX00hvLOKuW7DwAf7Nsglqiznf8hNcQfp8pas/MqZg OgOZz6m+nBcUGEgbUxz2HaCCtKC98S7IK/o4tFhcA7MimhzYLkxl6RiowTAFpPNnyONN t3pEgLzqBlo0WegxImsE8bs2fgOVF0niyVaGEhTHHBD4JtvGIrjJ7eGEBUbQZlZIiIvB vTjU5YtPI1+ttIDZXXxsTMCGjx6bjqAfh5S4/hGgX2SyWWABq0RBJ234vgTt9cJts0eg CnqQ== X-Gm-Message-State: APjAAAV06KCjZpmAdlgNAlf9yhBJtRCi8CpJMpPVivDLiPBRFohhW98P gLKy94RJMv/kcUR3bXQDnnQTgA== X-Google-Smtp-Source: APXvYqx235Kl3grccIQUjPB8ZF5N10XjUFC2beJj8pbLj0J38xkTgQgEzhAGnwcJhKfAz+II/BDvzQ== X-Received: by 2002:a17:90b:f06:: with SMTP id br6mr27855933pjb.125.1577475981611; Fri, 27 Dec 2019 11:46:21 -0800 (PST) Received: from nimloth.alvh.no-ip.org ([179.56.30.174]) by smtp.gmail.com with ESMTPSA id b42sm15555012pjc.27.2019.12.27.11.46.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 27 Dec 2019 11:46:20 -0800 (PST) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 34FC73008FE; Fri, 27 Dec 2019 16:46:18 -0300 (-03) Date: Fri, 27 Dec 2019 16:46:18 -0300 From: Alvaro Herrera To: Kyotaro Horiguchi Cc: craig@2ndquadrant.com, tomas.vondra@2ndquadrant.com, pgsql-hackers@postgresql.org Subject: Re: xact_start for walsender & logical decoding not updated Message-ID: <20191227194618.GA30125@alvherre.pgsql> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="BXVAT5kNtrzKuDFl" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20191213.150124.69303805839083319.horikyota.ntt@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --BXVAT5kNtrzKuDFl Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit On 2019-Dec-13, Kyotaro Horiguchi wrote: > At Fri, 13 Dec 2019 13:05:41 +0800, Craig Ringer wrote in > > On Wed, 11 Dec 2019 at 02:08, Alvaro Herrera > > wrote: > > > > > On 2019-Dec-10, Tomas Vondra wrote: > > > > > > > On Tue, Dec 10, 2019 at 09:42:17AM +0900, Kyotaro Horiguchi wrote: > > > > > At Tue, 10 Dec 2019 00:44:09 +0100, Tomas Vondra < > > > tomas.vondra@2ndquadrant.com> wrote in > > > > > > > > I'm not sure how much xact_start for walsender is useful and we really > > > > > is not running a statement there. Also autovac launcher starts > > > > > transaction without a valid statement timestamp perhaps for the same > > > > > reason. > > > > > > > > Maybe, but then maybe we should change it so that we don't report any > > > > timestamps for such processes. > > > > > > Yeah, I think we should to that. > > Agreed. Don't report a transaction start timestamp at all if we're not in a > > read/write txn in the walsender, which we should never be when using a > > historic snapshot. > > > > It's not interesting or relevant. This patch changes xact.c to avoid updating transaction start timestamps for walsenders (maybe more commentary is desirable). I think logical decoding is just a special form of walsender and thus it would also be updated by this patch, unless I misunderstood what Tomas explained. > > Reporting the commit timestamp of the current or last-processed xact would > > likely just be confusing. I'd rather see that in pg_stat_replication if > > we're going to show it, that way we can label it usefully. > > Sounds reasonable. Developers interested in this feature can submit a patch, as usual :-) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services --BXVAT5kNtrzKuDFl Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="walsender-stmtts.patch" diff --git a/src/backend/access/transam/xact.c b/src/backend/access/transam/xact.c index 5353b6ab0b..63652ab19f 100644 --- a/src/backend/access/transam/xact.c +++ b/src/backend/access/transam/xact.c @@ -816,6 +816,10 @@ GetCurrentTransactionStopTimestamp(void) void SetCurrentStatementStartTimestamp(void) { + /* walsenders don't want to have stmt timestamps */ + if (am_walsender) + return; + if (!IsParallelWorker()) stmtStartTimestamp = GetCurrentTimestamp(); else --BXVAT5kNtrzKuDFl--