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 1tseug-0047QN-UG for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Mar 2025 09:31:39 +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 1tseud-008u9v-U0 for pgsql-hackers@arkaria.postgresql.org; Thu, 13 Mar 2025 09:31:35 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tseud-008u4W-FU for pgsql-hackers@lists.postgresql.org; Thu, 13 Mar 2025 09:31:35 +0000 Received: from mail-wm1-x332.google.com ([2a00:1450:4864:20::332]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tseub-002aZ6-0d for pgsql-hackers@lists.postgresql.org; Thu, 13 Mar 2025 09:31:34 +0000 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-43cf848528aso6030045e9.2 for ; Thu, 13 Mar 2025 02:31:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1741858292; x=1742463092; 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=BNjODzrXYb00bRVLN/ddPTw5yeMmS80QoE8tLKBXaQQ=; b=icxnqu5RVUsS1vXvNFE19h4/XD9WNRntsiYK5uMNa4twbvrTOVGH9dt8jyYNWevFga /gZc/0apw9a7WGuaAbNGYmdJvI9+b1CgcWl6do8QPDz6McN9O5RmlLuYn59L2USM10e+ vJ9CSnszq3/MEzqFdm4PDQEOiBiJFy1EXgp/C97cCHPVP13es16Y2TgB9qU6zf8uEjvg qwhqd9vMnESw9Sxpt8NXWSEQGq5wG4gRe/SYRFkE5Ez3K/JP2bTRB+Lh7JWvkGpS3lcC d1kd0IVBI4jD3szZiTdt2hpB4kcWuBb8sNd/AageIrT4hRfcKVOKMvZAeNJu6gci+2ix Y+VA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1741858292; x=1742463092; 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=BNjODzrXYb00bRVLN/ddPTw5yeMmS80QoE8tLKBXaQQ=; b=c1lIo+CQUmeqLLmN6e3wMvctWwUJchBiG2i1zHoDj6LlO4ecV+RdnubM0f3OVKvUUg 3RHyw4YAVfprZ+bSM29iqGpjKGfDdsJfLUR8YROizMS/AFDAxbO8EaoJMz3uOr2XBbkY ug9dJrS8OKjXoPs1HbrNWpdGijhNCCu9FTDSrtuUPN3svkl4IpZYM5JkIjssTioUO1Ph xz5WxKwErjUNI/1riV8PHkXbTTV3YUhdov8QNf3vJ5B7B0+g9SyS69X5E3niJjZIsfpm UoCAGldS9Vw5nFMSqf9/weDPKj53g9o42Qcb9fpwp2D+McbBo8HZN+VTpuj8uhieHxzY y+Dg== X-Gm-Message-State: AOJu0Yz7R7sg/ke5QZotiivhX68O0+wQoS2nCUcttu/grXVDg+f61RP2 0kBTfZ+RQIv3VOiZF8b0hcqsBISQjGx/OlF4Ww1NB7/3Y/E64mxjUoiLFg== X-Gm-Gg: ASbGncucsev231qpYxVIvHKCZes4Q9VPqOxEV5YN++YsCtxeRqa81uWLtn8mP8jPI0U tRyHEUYFWpEnepk7Z6Z0qoTvqHV0SiHiNhQumS9UbxgC2EvrF+NTGfHfRt4oDrxLlCZEg2m+RHT /jCNLi5PKt100NZSIvX+aXAHbkLQVrS8D3rIIU+xt/HYls9zzIhTm70Orr0DvwdBGulpI57PzVs UinIoTFWM9lYvLCzDi5MQNK8nWFP9SurpNwLHX/0eLjOHH5ILEp5aUAyhVXQFL0O03RB3VtZVBT DAyxhpI1PutXl+pwDt9f9IUD7hIqSYfC1Kc6nmTZ07h+4F0eh00XETxakw7Hn3XF8pfq3H9XP4C BL+DfGlD6rK/OLrMhDC7X6YSKokmMTb/EgkZ/uUmfUPDkFAVavPjA5N/kt9fITqb1QZ0k91S667 z7rGGpnHcDcQs= X-Google-Smtp-Source: AGHT+IH7htptvF/h5TcGuSUMhONJs2HnFo8DJfyAG4wBrB/8slp2MOYT9HQJ3syQsNrRGVlbQJsTmQ== X-Received: by 2002:a05:600c:5812:b0:43d:1824:aadc with SMTP id 5b1f17b1804b1-43d1824ab86mr12203725e9.29.1741858291525; Thu, 13 Mar 2025 02:31:31 -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-395c82c255bsm1475471f8f.23.2025.03.13.02.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 13 Mar 2025 02:31:30 -0700 (PDT) Date: Thu, 13 Mar 2025 09:31:29 +0000 From: Bertrand Drouvot To: Michael Paquier Cc: pgsql-hackers@lists.postgresql.org Subject: Re: [BUG]: the walsender does not update its IO statistics until it exits Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="jnHzDq0jK9SJt44i" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --jnHzDq0jK9SJt44i Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Hi, On Tue, Mar 11, 2025 at 06:10:32AM +0000, Bertrand Drouvot wrote: > WalSndWaitForWal() is being used only for logical walsender. So we'd need to > find another location for the physical walsender case. One option is to keep the > WalSndLoop() location and control the reports frequency. I ended up with an idea in the same vein as your third one, but let's do it in WalSndLoop() instead for both logical and physical walsenders. The idea is to report the stats when the walsender is caught up or has pending data to send. Also, we do flush only periodically (based on PGSTAT_MIN_INTERVAL). Remarks/Questions: 1. maybe relying on PGSTAT_IDLE_INTERVAL would make more sense? In both case PGSTAT_MIN_INTERVAL or PGSTAT_MIN_INTERVAL, I'm not sure there is a need to update the related doc. 2. bonus point to make it here is that we don't need an extra call to GetCurrentTimestamp(). We simply assign the one that is already done to "now". 3. add to use poll_query_until() has I've seen failures on the CI whith this new approach. Also moving the test far away from the stats reset to to minimize the risk of polling for too long. With the attached in place, the number of times the stats are being flushed reduce drastically but still seems enough to get an accurate idea of the walsender IO activity. Thoughts? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com --jnHzDq0jK9SJt44i Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v4-0001-Flush-the-IO-statistics-of-active-walsenders.patch"