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.96) (envelope-from ) id 1w2HFm-0009KN-1B for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 23:21:42 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1w2HFl-00E9FZ-0i for pgsql-hackers@arkaria.postgresql.org; Mon, 16 Mar 2026 23:21:41 +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.96) (envelope-from ) id 1w2HFk-00E9FQ-2R for pgsql-hackers@lists.postgresql.org; Mon, 16 Mar 2026 23:21:40 +0000 Received: from fout-a2-smtp.messagingengine.com ([103.168.172.145]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1w2HFh-000000005l2-1fv7 for pgsql-hackers@postgresql.org; Mon, 16 Mar 2026 23:21:39 +0000 Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfout.phl.internal (Postfix) with ESMTP id B6135EC0AE2; Mon, 16 Mar 2026 19:21:37 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Mon, 16 Mar 2026 19:21:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm1; t=1773703297; x=1773789697; bh=rZTy4Oltv1 yjqR0BydqPOPHsInn+FC6BGll88uUG91E=; b=WYaZmYfCvFNDQziB4pHE+U89JE jcYA1iE2Ah923+hS9E1tDdj6z6FLfSjrt2SloOt5TorfPwuWfLSPHNkY+/u1yO9c JccjaEPrc6JblmWEhHHuKHsVvrGMufmS5mFy/7+Wjl/qoMGPIx/hGTmzik26358Z 1f1K/RHRP2BxT037b3CiDDLmKSfq2WGip9Su22qgD+Zlo5lQBPA7QEk3f4IXZwLs Eb+CKdgK21FpBBWsWRHSLNOvmJyHSXhYmCoNNdXRRTXSUqBZAigAahvMZcJjD5Pt 1WrOzM1luUlm+V/VBjvGdhqzwzT5cv6eY9E7Onvt2eRS/RMYkr8QgWZ2LEqQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1773703297; x=1773789697; bh=rZTy4Oltv1yjqR0BydqPOPHsInn+FC6BGll 88uUG91E=; b=nWvp4NzMQEtsUrMd+xn/x3/rDTAOvnLlbrGJBYxc2c/WiKUtBBy mBciDtFSdvCIhyWSfEg5FBWUGIh0zCwD/CINk1SyA4BeizYL9PwSCBikcvENMgtL 6Nd9cbNMv2lWBNnHuAzWy/dTVQG8iUXWajjvRJhBgSyK9Fjw+7dSkPEYL57leAyl g62djsWHMC6x/QDUnmPok2GNJztBe5o2fz0fjyd9reuAjRL9hcCTfHu+0wx8QRCd Yn1CRqb+8Q8phGz11SC5FcJsBmawwBtypq2bCCWWQZL8auzFxSRI/sQsXjIfnDPg LzYDykDMrdcIYKcUS0ocCQ8dBR3PkWWP53Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefgedrtddtgddvleelieelucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnegfrh hlucfvnfffucdljedtmdenucfjughrpeffhffvvefukfhfgggtuggjsehgtderredttddv necuhfhrohhmpefoihgthhgrvghlucfrrghquhhivghruceomhhitghhrggvlhesphgrqh huihgvrhdrgiihiieqnecuggftrfgrthhtvghrnhepteelieefudffhffhtdetleeggeeg fffhkeeuveetiefgudduvedutefggeeivdejnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepmhhitghhrggvlhesphgrqhhuihgvrhdrgiihiidp nhgspghrtghpthhtohepjedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtoheprghshh hurdgtohgvkhekkeesghhmrghilhdrtghomhdprhgtphhtthhopegrshhhuhhtohhshhdr sggrphgrthdrohhsshesghhmrghilhdrtghomhdprhgtphhtthhopegsvghrthhrrghnug gurhhouhhvohhtrdhpghesghhmrghilhdrtghomhdprhgtphhtthhopegrnhgurhgvshes rghnrghrrgiivghlrdguvgdprhgtphhtthhopegrmhhithdrkhgrphhilhgrudeisehgmh grihhlrdgtohhmpdhrtghpthhtohepshhhvhgvthgrrdhmrghlihhksehgmhgrihhlrdgt ohhmpdhrtghpthhtohepphhgshhqlhdqhhgrtghkvghrshesphhoshhtghhrvghsqhhlrd horhhg X-ME-Proxy: Feedback-ID: i0fe9450f:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 16 Mar 2026 19:21:35 -0400 (EDT) Date: Tue, 17 Mar 2026 08:21:31 +0900 From: Michael Paquier To: Ashutosh Sharma Cc: Ashutosh Bapat , Bertrand Drouvot , Andres Freund , Amit Kapila , shveta malik , pgsql-hackers Subject: Re: Report bytes and transactions actually sent downtream Message-ID: References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="XyW0BeS/1/6VUgli" Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --XyW0BeS/1/6VUgli Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 16, 2026 at 01:20:57PM +0530, Ashutosh Sharma wrote: > 1) v20260316-0001-Report-downstream-sent-bytes-in-pg_stat_replication_.pa= tch: >=20 > This patch introduces sent_bytes to report the amount of data sent > downstream. It documents sent_bytes in a way that it clarifies how > sent_bytes differs from total_bytes, without modifying the existing > documentation for total_bytes or total_txns. The patch is purely > additive and does not alter any existing documentation. + elog(DEBUG2, "UpdateDecodingStats: updating stats %p %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64 " %" PRId64, This was already unreadable before the patch, and it makes the situation worse. Could it be possible to append the names of each field here? + qq(Check that reset timestamp is later after the second reset of stats for slot '$stats_test_slot1' and confirm total_bytes and sent_bytes were set to 0.) Not your fault here as well, but I would replace that by a comment at the top of the test. Still your patch makes things harder to read. + Amount of transaction changes sent downstream for this slot by the + output plugin after applying output plugin filters, if any, and + converting it into the output plugin format. Do we need to be that fancy here? The concept relates to the number of bytes sent downstream. Here is a suggestion: "Amount of bytes decoded and sent downstream by the output plugin. This accounts for the output plugin filters, if any, and for the conversion into the output plugin format." Perhaps we had better document at the top of LogicalOutputWrite() that "sentBytes" ought to be updated for all the fields we are sending part of the tuplestore? Why are you not counting the "now" timestamp in WalSndWriteData()? This is appended to the stream of data with a separate pq_send*() call. Perhaps the reason why this is not appended is worth a comment? The trick with this patch is to make sure that all the relevant places where data is sent downstream are correctly incremented. As far as I can see, things seem to be covered, but I cannot help but wonder if we are missing one or more places. @Amit, do you feel a hole somewhere? -- Michael --XyW0BeS/1/6VUgli Content-Type: application/pgp-signature; name=signature.asc -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAmm4kHsACgkQnvQgOdby QH0dNQ/8DHC2dN4tezSeUdLugGZGR3z64t382KGnZECLzXc5bAY/h4v4PYYXsMMC QkYWMxz/lJFvWFkC0C1yh5W8YqT9fSGEoBATHPAtj1YyPt54WKrzJw+pIYDstB0f jvwaWR8wWtLZQCTLUv7CwHy2doiLyfhoqcdU8Mo4QqRkfOQfB4rZKB177/Tjq+xr bUMmY/+caighxFNJJ0zFDiv/iSjdqBpce3gUan3QUQQQMpqlehPp5umUFx+vBxWj blMaVA/dqfH3/54rGh9f7QW8XZeb8EwF7cqytqwP6Bk4K5ue1jFhDpEdvzP5vvuE 8YrAiQ3nw7bptvGPkEnFHvGYn/KoC5+FNLZAOiH/psOlF9u5EmFD0PtT8oLyrle1 qgMtXxIXvqcrg1HcY6qykdFto78t2PPip/H3IME++PIyjoMH0VWhq/V0MYrIFobJ pYvkw2FfSoYxMk63vP1oAEuHZUF9wiN/kt6itOHn8V2ZuwoXIMCLgUoxiZBa1kkD CnLQWRpmEAMo/gME8pSYsGAIj9gZmmg4ebzd71K7VQ2mCZuTN+vnrJK1vttRFZWI G8NhUjlMaVsanVODN27wDp/MHqo7CA0lMBlvz79RKZCDP4GtZWfS3oZ9CwRdDzHn JeGDQSFuCNLvPApa/VclIBmFy4Ysg3fuLV5xgw4WJ+lkfWovhXg= =I7Wy -----END PGP SIGNATURE----- --XyW0BeS/1/6VUgli--