Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzEpZ-00H6Kt-Jv for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Mar 2025 13:05:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tzEpX-005YYI-St for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Mar 2025 13:05:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tzEpX-005YXL-FU for pgsql-hackers@lists.postgresql.org; Mon, 31 Mar 2025 13:05:31 +0000 Received: from mail-wr1-x434.google.com ([2a00:1450:4864:20::434]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tzEpU-002EDO-2d for pgsql-hackers@lists.postgresql.org; Mon, 31 Mar 2025 13:05:31 +0000 Received: by mail-wr1-x434.google.com with SMTP id ffacd0b85a97d-399744f74e9so2915725f8f.1 for ; Mon, 31 Mar 2025 06:05:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1743426327; x=1744031127; darn=lists.postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=0DYVBKWiIkq2z8xkFlSU46u4KMGXm4n2CQ597MkLzz0=; b=G1XwuQHJKbxTov4F9U2mczdYdbU0E3d5w9jU50yt6Z+Ugjue1L1hLOoMxNKmxMSWga xKkbdE+ROW7wCVRfQZQhlSM80Qva8EacntUdPlDwIK59TS78Qgj/wX9wZJxJhAam/v8I wj3HAmPHg4sBmuBZDphILiMCheuMRhTxNmirFumraWhRQzMc0SCYD8k5lY3BvGbQdvHn 8X+3Ir1d/bRVLwhxeZadFHPZAr1gkmsPbUR6FUGUNBxr4wtbky0ppazYB3cktw3GuWsL 8mSWRiOrmvzsn0ZbXdkgUJQcODWoi5lul7z/OrsKlYZyrayRsuVQOmyTks81/3+q7dVI wZng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1743426327; x=1744031127; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0DYVBKWiIkq2z8xkFlSU46u4KMGXm4n2CQ597MkLzz0=; b=frhHitXZmLq9LMzBHMMgvriVAVfWZU+tNqymW21Kx4d2a8FTRu0VAkD0yjkaAGs48q GVn6LcOr7+wf6K5MNsvDJbK4huthdA5gdg01fvBKr0xqCaA6VCTBKhLGq3fxWb5fsScH yguP6/H5wwb2xnIqVB+InGzOXlmyIH5oSWICnJSEzpRSRhRAt/604oUcUjgPWycUyHkV xjdrovnPB/Ea2LPyQSmfDibzmeg71xiytcHXRccaTGeGJVeS+EyjnWNLlbCjaGkTP94X JXu8T2vqVCAdImud9QFBCX3k5YTsO0DCIXvqAi1uGgvji2YNEeIU2R8CyUXyEOJQdlem vJmA== X-Forwarded-Encrypted: i=1; AJvYcCVo9uhVOnAlYHpae2sW0HGUavEqyDB3HDBHY85zcGx3IkwkvsDgy6tKMmA16NmwDroalxcCoYWev1O6boN6@lists.postgresql.org X-Gm-Message-State: AOJu0Yz8x79HKJkkeVaHZ4627PeHqyGHbpk6ySnRhFl92/hQv/a97BPn /gxY+wwPNz64wEt3UGkU9CkbSjfDdFMFz1AVRyl4WTCC1zvjkwjh X-Gm-Gg: ASbGncuIrJSjYt6cWnNTcA8MwtP0yFztsVZ7HCmQ+THz1C/pxqoTOA7waM2MjOw6sH0 iRLXSV5m+zXE7PdYowkvbm+pokDLyEH3pXtF45MeQFaButl1knbWzaYHiMkCS//8R4i3FfKrtZS ZRDkVQXArLQp2e8fd8r9+SxGs7FUMJspH4koUfZ2jSN2R1xs038pJxVMpdVlN0nEN6eI5NeHM4x Y1ECUteXhyOkTtQERktfhxY46A3llNLTvVtjkv+JDO3jafd1TrN0CqtwbjLeTznGpD5eiSWE10n Xe0gi59fAX0U8oHZcLWqN17kk5ZTfEcHk9/9khs3erLqASZVSjve52nwitWtqZQNCNT7rNDCM0Z vwuR7lqzos9XcJijf5fJeh7C7AFQX51ia3FHImqJ0gePvaoFJYyG76vN0AoWYKLXB80Cv0euMFP P2 X-Google-Smtp-Source: AGHT+IGjuipJvHaj4iMRdQwArj0yBjBrqZ/ELMiDodzkX5cWif1ofZ2BkkY5MoCrteGLp25LC9UIVg== X-Received: by 2002:a05:6000:2910:b0:391:4873:7943 with SMTP id ffacd0b85a97d-39c120e0a9emr6724611f8f.32.1743426326403; Mon, 31 Mar 2025 06:05:26 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-237-181-182.eu-west-3.compute.amazonaws.com. [15.237.181.182]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-39c0b66a96dsm11078628f8f.44.2025.03.31.06.05.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Mar 2025 06:05:25 -0700 (PDT) Date: Mon, 31 Mar 2025 13:05:24 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: Xuneng Zhou , Andres Freund , pgsql-hackers@lists.postgresql.org Subject: Re: Fwd: [BUG]: the walsender does not update its IO statistics until it exits Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="gmFEkRlSpLUMOhSL" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --gmFEkRlSpLUMOhSL Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Mon, Mar 24, 2025 at 08:41:20AM +0900, Michael Paquier wrote: > On Wed, Mar 19, 2025 at 04:00:49PM +0800, Xuneng Zhou wrote: > > Hi, > > Moving the other two provides a more complete view of the settings. For > > newcomers(like me) to the codebase, seeing all three related values in one > > place helps avoid a narrow view of the settings. > > > > But I am not sure that I understand the cons of this well. > > While I don't disagree with the use of a hardcoded interval of time to > control timing the flush of the WAL sender stats, do we really need to > rely on the timing defined by pgstat.c? No but I thought it could make sense. > Wouldn't it be simpler to > assign one in walsender.c and pick up a different, perhaps higher, > value? I don't have a strong opinion on it so done as suggested above in the attached. I think that the 1s value is fine because: 1. it is consistent with PGSTAT_MIN_INTERVAL and 2. it already needs that the sender is caught up or has pending data to send (means it could be higher than 1s already). That said, I don't think that would hurt if you think of a higher value. > At the end the timestamp calculations are free because we can rely on > the existing call of GetCurrentTimestamp() for the physical WAL > senders to get an idea of the current time. Yup > For the logical WAL > senders, perhaps we'd better do the reports in WalSndWaitForWal(), > actually. There is also a call to GetCurrentTimestamp() that we can > rely on in this path. I think it's better to flush the stats in a shared code path. I think it's easier to maintain and that there is no differences between logical and physical walsenders that would justify to flush the stats in specific code paths. Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com --gmFEkRlSpLUMOhSL Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v5-0001-Flush-the-IO-statistics-of-active-walsenders.patch"