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 1oBJWd-0005gt-Je for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2022 17:18:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oBJWc-0001QW-7e for pgsql-hackers@arkaria.postgresql.org; Tue, 12 Jul 2022 17:18:18 +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 1oBJWb-0001QN-Qe for pgsql-hackers@lists.postgresql.org; Tue, 12 Jul 2022 17:18:17 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oBJWZ-0003h0-7n for pgsql-hackers@postgresql.org; Tue, 12 Jul 2022 17:18:16 +0000 Received: from compute2.internal (compute2.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 7E8AC5C00D3; Tue, 12 Jul 2022 13:18:13 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute2.internal (MEProxy); Tue, 12 Jul 2022 13:18:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= cc:cc:content-type:date:date:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:sender:subject :subject:to:to; s=fm3; t=1657646293; x=1657732693; bh=pTCqfADNg4 kRs3+i2vz9bkYtiYVZsBjEXi+X5BPX4bM=; b=OxQkNiJ+c/XXT+mzKukodTVEst qpGuJndZBNdR4JqkN9V4t0SwG/P+XXIlMu9afPAuQ7LTtmfHNq53xPF9IZtQumrT +3gp+sY8w/+0DqMYTtvzaZ/J/SVmGAxD//OirhfkobLxUlJgyVexI2EZ8FvFD4OT B04U6igfybxP6EudVXAlA7zmDn1ZQjTRdZNYImZ4vTQi08Ro2K6ge67g/aTgpAjd LBnQuZZ56ytYiKslu4l9/kFCNNbSGNJk4FXSSk6lA7zTM1pCww7svveIZDlBO1zG N6T7gEA2ERTZkaLyxoTnzK4FNeM1oHIWKNZMRxspVyLPQD7nLDdcvNrNkDIw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:date:date:feedback-id :feedback-id:from:from:in-reply-to:in-reply-to:message-id :mime-version:references:reply-to:sender:subject:subject:to:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1657646293; x=1657732693; bh=pTCqfADNg4kRs3+i2vz9bkYtiYVZ sBjEXi+X5BPX4bM=; b=kv5fwhHhHuoLBuLNpfGneXN/cK7Mriq1yI+AOVK+O1MG S/794n7XibKHEQWcSfdahSk9zB0TkrGs84ZBuzXC4ECcdVO9VcfHYwcXq4kbuO5S JAiwW7hRIz0W5ulmGNnjqi0GAY+J7I53GE5bGl4Vl8q7YBDC42IvR692F2NRPuRP 1NW3xEmGmatEizukXqcXcHVGTQYB5TN3LaOivNlJxLBX1zCVhXr9d55mHS4uPzxl Fboq73fvnde3vG6lTXAL2j8W3jhpFv6HjNXguNR+qC0sWUtXvikARD1105o/fwyW aftEDH1yQVwS4QL0s/q1KXh3kMnoU3/QL0Pm07+8zA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvfedrudejhedgudduvdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvvefukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgu rhgvshcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucggtf frrghtthgvrhhnpedvffefvefhteevffegieetfefhtddvffejvefhueetgeeludehteev udeitedtudenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhepmhgrihhlfhhroh hmpegrnhgurhgvshesrghnrghrrgiivghlrdguvg X-ME-Proxy: Feedback-ID: id4a34324:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 Jul 2022 13:18:12 -0400 (EDT) Date: Tue, 12 Jul 2022 10:18:10 -0700 From: Andres Freund To: Melanie Plageman Cc: Justin Pryzby , Alvaro Herrera , Kyotaro Horiguchi , Magnus Hagander , Pg Hackers , Lukas Fittl , Thomas Munro Subject: Re: pg_stat_bgwriter.buffers_backend is pretty meaningless (and more?) Message-ID: <20220712171810.7f2ppc45torgaavu@awork3.anarazel.de> References: <20211216201837.fm73l7zixfjknttd@alap3.anarazel.de> <20220322001505.fgysjvihvagduete@alap3.anarazel.de> <20220706192047.sikr2vuwvpslqdrw@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On 2022-07-11 22:22:28 -0400, Melanie Plageman wrote: > Yes, per an off list suggestion by you, I have changed the tests to use a > sum of writes. I've also added a test for IOPATH_LOCAL and fixed some of > the missing calls to count IO Operations for IOPATH_LOCAL and > IOPATH_STRATEGY. > > I struggled to come up with a way to test writes for a particular > type of backend are counted correctly since a dirty buffer could be > written out by another type of backend before the target BackendType has > a chance to write it out. I guess temp file writes would be reliably done by one backend... Don't have a good idea otherwise. > I also struggled to come up with a way to test IO operations for > background workers. I'm not sure of a way to deterministically have a > background worker do a particular kind of IO in a test scenario. I think it's perfectly fine to not test that - for it to be broken we'd have to somehow screw up setting the backend type. Everything else is the same as other types of backends anyway. If you *do* want to test it, you probably could use SET parallel_leader_participation = false; SET force_parallel_mode = 'regress'; SELECT something_triggering_io; > I'm not sure how to cause a strategy "extend" for testing. COPY into a table should work. But might be unattractive due to the size of of the COPY ringbuffer. > > Would be nice to have something testing that the ringbuffer stats stuff > > does something sensible - that feels not entirely trivial. > > > > > I've added a test to test that reused strategy buffers are counted as > allocs. I would like to add a test which checks that if a buffer in the > ring is pinned and thus not reused, that it is not counted as a strategy > alloc, but I found it challenging without a way to pause vacuuming, pin > a buffer, then resume vacuuming. Yea, that's probably too hard to make reliable to be worth it. Greetings, Andres Freund