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 1ltmFh-00073o-11 for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jun 2021 07:15:49 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1ltmFf-0006Tb-Oq for pgsql-hackers@arkaria.postgresql.org; Thu, 17 Jun 2021 07:15:47 +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 1ltmFf-0006TS-H6 for pgsql-hackers@lists.postgresql.org; Thu, 17 Jun 2021 07:15:47 +0000 Received: from sfr-1.cri.mines-paristech.fr ([77.158.180.225] helo=smtp.cri.ensmp.fr) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ltmFY-00009A-4r for pgsql-hackers@postgresql.org; Thu, 17 Jun 2021 07:15:46 +0000 Received: from petersbourg.cri.ensmp.fr (petersbourg.cri.ensmp.fr [10.2.14.5]) by smtp.cri.ensmp.fr (Postfix) with ESMTPSA id 5AB2DC0227; Thu, 17 Jun 2021 09:17:32 +0200 (CEST) Date: Thu, 17 Jun 2021 09:15:37 +0200 (CEST) From: Fabien COELHO X-X-Sender: fabien@pseudo To: Kyotaro Horiguchi cc: nagata@sraoss.co.jp, gregsmithpgsql@gmail.com, pgsql-hackers@postgresql.org, david.christensen@crunchydata.com Subject: Re: pgbench logging broken by time logic changes In-Reply-To: <20210617.141756.654908256727895408.horikyota.ntt@gmail.com> Message-ID: References: <20210617025138.04a35c3ae9a6cd40c077cea0@sraoss.co.jp> <20210617122342.74aa8e65b186a7f2e0034533@sraoss.co.jp> <20210617.141756.654908256727895408.horikyota.ntt@gmail.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="2056645051-1824793688-1623914137=:2693553" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --2056645051-1824793688-1623914137=:2693553 Content-Type: text/plain; format=flowed; charset=US-ASCII Hello, >>> I cannot say that I'm thrilled by having multiple tv stuff back in several >>> place. I can be okay with one, though. What about the attached? Does it >>> make sense? > > +1 The patch rounds down sd->start_time from ms to s but it seems to > me a degradation. Yes, please we should not use time. >> At first, I also thought of fixing pg_time_now() to use gettimeofday() instead >> of INSTR_TIME_SET_CURRENT, but I noticed that using INSTR_TIME_SET_CURRENT is >> proper to measure time interval. I mean, this macro uses >> lock_gettime(CLOCK_MONOTONIC, ) if avilable, which give reliable interval >> timing even in the face of changes to the system clock due to NTP. > > If I understand the op correctly, the problem here is the time values > in pgbench log file are based on a bogus epoch. It is not "bogus", but is not necessary epoch depending on the underlying function called behind by INSTR_TIME macros, and people are entitled to expect epoch for log correlations. > If it's the only issue > here and and if we just want to show the time based on the unix epoch > time, just recording the difference would work as I scketched in the > attached. (Precisely theepoch would move if we set the system clock > but I don't think that matters:p) I do like the approach. I'm hesitant to promote it for fixing the beta, but the code impact is small enough, so I'd say yes. Maybe there is a similar issue with progress which should probably use the same approach. I think that aligning the implementations can wait for pg15. The patch as white space issues. Attached an updated version which fixes that, adds comments and simplify the code a little bit. > I'm not sure we have transaction lasts for very short time that > nanoseconds matters. Indeed. -- Fabien. --2056645051-1824793688-1623914137=:2693553 Content-Type: text/x-diff; name=pgbench-epoch-4.patch Content-Transfer-Encoding: BASE64 Content-ID: Content-Description: Content-Disposition: attachment; filename=pgbench-epoch-4.patch ZGlmZiAtLWdpdCBhL3NyYy9iaW4vcGdiZW5jaC9wZ2JlbmNoLmMgYi9zcmMv YmluL3BnYmVuY2gvcGdiZW5jaC5jDQ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