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 1ieeAY-0003jQ-AX for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Dec 2019 11:59:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ieeAX-0004zu-36 for pgsql-hackers@arkaria.postgresql.org; Tue, 10 Dec 2019 11:59:09 +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 1ieeAW-0004zn-M2 for pgsql-hackers@lists.postgresql.org; Tue, 10 Dec 2019 11:59:08 +0000 Received: from mail-wr1-x443.google.com ([2a00:1450:4864:20::443]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ieeAT-0008Pr-WE for pgsql-hackers@postgresql.org; Tue, 10 Dec 2019 11:59:07 +0000 Received: by mail-wr1-x443.google.com with SMTP id w15so19819401wru.4 for ; Tue, 10 Dec 2019 03:59:05 -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:references:mime-version :content-disposition:in-reply-to; bh=LxPADt9+MumycxyXBUWLIBK6zRzGbOlRWT0wJT/QwI4=; b=v//fWvhYx7TZfboUQGv0bUsHmgb2WrKGqcCR9NQxwVpzbZ25lqZim6zOAo0gKwhZYF 4MkRSex4FIpDvLC5qzHYOtnC8uMSuKXif+OQr1cpVOu1r5y0HKwwr2eJbxIkMlP79nLL KmqC8KuA4lxUv4lgeImvxxvvAkb0Dw2LYfbdOcRCtxLusCuHzzPWXMCGhwinPq94Irav 4Mb13PaLQsXwdGSCjhj2wSTGqzpAHwxMC91MWN6pCVDigddknhYFHRq+jz/Xz7kcW6Wu 9Nqd6cCniQnIBZHu7tjQkuQfh1YF7qiQk/7kUdCm1Vew7gAPf5n8QP5niuZTskXhE14a KMIw== 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=LxPADt9+MumycxyXBUWLIBK6zRzGbOlRWT0wJT/QwI4=; b=NPmEpCLU3XYxkASExY5YEKIkvKZlvKKCetQiuIQPa/wQTsVjySLv3zUS7gvXQF96jG T/8nncdRLR5PMBUQJyqUwuKusVhxYCPeW0kzb7sLol/JLaXmpeTTbZFonnVizaE9Yxf5 Q6TfGuQD2bBnNvN/KA0Op11va7ABmgrq+wMPDdlX5J66Ft4SSY98Kj2IqieGdGPPChKY vFTrKoezFeqf/0o9/syxDAo77hzhe9xGJW/KnmUj1CHDGS/jTAzcqFwVAyigchARzrtK YSGeJKwXwNpKgzEAgtauU1D5LMpuWF0uLBHAnZ9hk73HW9DOamZAgcqqtyndyY+qDFSX WMtQ== X-Gm-Message-State: APjAAAWnrDH1XlgdZIWQQSdOxsE87BOG4Ur8DIoenbiFju4PIyZBhM5R L74Vc2H/nnU8uUMtZLPyQ0VmlQ== X-Google-Smtp-Source: APXvYqwTZStsw+i9MG4MX5MYgvXgUd6r3G4TnKKa8TTFtFq3qO0QaF5M9zR0zPb6nLoScx6bXaSBZQ== X-Received: by 2002:adf:f103:: with SMTP id r3mr2741565wro.295.1575979144561; Tue, 10 Dec 2019 03:59:04 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id i10sm2967265wru.16.2019.12.10.03.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2019 03:59:03 -0800 (PST) Date: Tue, 10 Dec 2019 12:59:03 +0100 From: Tomas Vondra To: Kyotaro Horiguchi Cc: pgsql-hackers@postgresql.org Subject: Re: xact_start for walsender & logical decoding not updated Message-ID: <20191210115903.x5j3rfxtr3notsut@development> References: <20191209234409.exe7osmyalwkt5j4@development> <20191210.094217.2248726849034272968.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <20191210.094217.2248726849034272968.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Tue, Dec 10, 2019 at 09:42:17AM +0900, Kyotaro Horiguchi wrote: >At Tue, 10 Dec 2019 00:44:09 +0100, Tomas Vondra wrote in >> Hi, >> >> I think there's a minor bug in pg_stat_activity tracking of walsender >> processes. The issue is that xact_start is only updated at the very >> beginning when the walsender starts (so it's almost exactly equal to >> backend_start) and then just flips between NULL and that value. >> >> Reproducing this is trivial - just create a publication/subscription >> with the built-in logical replication, and run arbitrary workload. >> You'll see that the xact_start value never changes. >> >> I think the right fix is calling SetCurrentStatementStartTimestamp() >> right before StartTransactionCommand() in ReorderBufferCommit, per the >> attached patch. > >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. >However, if we want to show something meaningful there, I think >commit_time might be more informative there. If we use >GetCurrentTimestamp(), StartTransaction() already has the same feature >for autonomous transactions. I suppose we should do them a unified >way. > I don't think so. We have this information from the apply side, and this is really about the *new* transaction started in reorderbuffer. regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services