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 1kSaeh-0002ME-QA for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Oct 2020 06:53:00 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kSaeg-0001vK-Hu for pgsql-hackers@arkaria.postgresql.org; Wed, 14 Oct 2020 06:52:58 +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 1kSaef-0001vD-RA for pgsql-hackers@lists.postgresql.org; Wed, 14 Oct 2020 06:52:58 +0000 Received: from wout3-smtp.messagingengine.com ([64.147.123.19]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kSaeZ-0003AW-4L for pgsql-hackers@postgresql.org; Wed, 14 Oct 2020 06:52:56 +0000 Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.west.internal (Postfix) with ESMTP id 04FCA4C7; Wed, 14 Oct 2020 02:52:48 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute1.internal (MEProxy); Wed, 14 Oct 2020 02:52:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm3; bh=3Qfk+NANe02B5JStHZoIDHRc6w+ 1EHMBQJVap1rigRs=; b=AR9Uw+IvVEajoXlQX6zwpUxGxkqLj1vqWNlK4WKGnmM GGADTxUfgtMWLLYQkkLrS+nhqr+9q7vyMN8woXG8wNKXlndHgDEHvROEBxpzHI7c gXUVRYWBHVKgrZksISOdgvZsLvviGKv4ES8moNBiQSrQKce1Y8hStgx4YUnn87gN OFCWSAJp0eux+epjQuoVTb2n5Dfw6q2XlEQunL/9ltVV6xnHJZ0Wp9w1xMBMMh8d +dYEaeTpAb8n8FQ1FyLaB03mtZTry2pEj/mne+Avo80Sj5Yx0k6yovnKOT7VYygm nknIYaLF89knUOlmAobckLpF+fEDNxHfpD659huqEOw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=3Qfk+N ANe02B5JStHZoIDHRc6w+1EHMBQJVap1rigRs=; b=YTzonlqqQU65qmUorifEuM qE+Cg5qG2p2hcTf61XU09wMME1CgaOA2NcpB4P1H4DYupvNuCPwizywXQbNsJKFz fLwYKjWRMj/KxZN/uB1oYO1z1hRvkbTXudKPtd5uK1c953l/1nPvb9dGguhEMOl/ 18birDKpQBy7cLuMrvdaNfeEnLyyJmuTox34zYjFforUZ8HsiB5eBD5bidESgqvk ebtiwhYzArbNor6akAt2deoGcMS4F+i6HmgGHinDoyFPN7VhY2lY/idcUhaBGXjR 0uLjToopq9/84cwnQPtw0hkr41Cw7PTMxzY6+75S1+d7vKNTtCpE9WnG/jM5M/1Q == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedriedtgdduudehucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucgfrhhlucfvnfffucdljedtmdenucfjughrpeffhf fvuffkfhggtggujgesghdtreertddtvdenucfhrhhomhepofhitghhrggvlhcurfgrqhhu ihgvrhcuoehmihgthhgrvghlsehprghquhhivghrrdighiiiqeenucggtffrrghtthgvrh hnpedvgeduuefhtdeuleettdevjeehheeiveeuieegleetgeeljeelieeuieehgeevhfen ucfkphepudduuddruddtvddrudektddrudekheenucevlhhushhtvghrufhiiigvpedtne curfgrrhgrmhepmhgrihhlfhhrohhmpehmihgthhgrvghlsehprghquhhivghrrdighiii X-ME-Proxy: Received: from paquier.xyz (ee0822lan1.rev.em-net.ne.jp [111.102.180.185]) by mail.messagingengine.com (Postfix) with ESMTPA id 6D0E3306467E; Wed, 14 Oct 2020 02:52:46 -0400 (EDT) Date: Wed, 14 Oct 2020 15:52:43 +0900 From: Michael Paquier To: Kyotaro Horiguchi Cc: movead.li@highgo.ca, pgsql-hackers@postgresql.org, ahsan.hadi@highgo.ca Subject: Re: Wrong statistics for size of XLOG_SWITCH during pg_waldump. Message-ID: <20201014065243.GA12403@paquier.xyz> References: <2020101009495929215052@highgo.ca> <20201012011212.GC2346@paquier.xyz> <2020101209463463842666@highgo.ca> <20201014.102944.102635524623180309.horikyota.ntt@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="GvXjxJ+pjyke8COw" Content-Disposition: inline In-Reply-To: <20201014.102944.102635524623180309.horikyota.ntt@gmail.com> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --GvXjxJ+pjyke8COw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Wed, Oct 14, 2020 at 10:29:44AM +0900, Kyotaro Horiguchi wrote: > The reason is the function XLogDumpRecordLen is a common function > among all kind of LOG records, not belongs only to XLOG_SWICH. And the > junk_len is not useful for other than XLOG_SWITCH. Descriptions > specifc to XLOG_SWITCH is provided by xlog_desc(). Yeah. In its current shape, it means that only pg_waldump would be able to know this information. If you make this information part of xlogdesc.c, any consumer of the WAL record descriptions would be able to show this information, so it would provide a consistent output for any kind of tools. On top of that, it seems to me that the calculation used in the patch is wrong in two aspects at quick glance: 1) startSegNo and endSegNo point always to two different segments with a XLOG_SWITCH record, so you should check that ReadRecPtr is not at a segment border instead before extracting SizeOfXLogLongPHD, no? 2) This stuff should also check after the case of a WAL *page* border where you'd need to adjust based on SizeOfXLogShortPHD instead. -- Michael --GvXjxJ+pjyke8COw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAl+GoDsACgkQnvQgOdby QH0bdg//U71AjpxwD/zCx88zf/E8JfquJTMz0FakyXrcLu6EgRl7WOruVtu8dL2/ 7OBde6ExbyxcfE7/2QSOp6ShC3Tb/QSaa/KSaAg0PSi9KLATZWCz2U0H9LB/KLNJ zwAMvrtDufY1lnHKJEXGgJQ0o8fhw6SsAiFA5/9e07JFI6KiYXIPRVsVmfbZeiDq mf21bUjbDyx1osO8F2l2eShzD6w3gfUGrinHIHhuLF4pG1z0/eLW7RRFhlalSKaD Q6ua/uwDttFx+0Jj3XzR9EY/4KAf14PtwflIH6X+pKfjgRan36B1GFykykmEAUqy oyCx0xpIQjf/5Yaq3WGTubEKGdipPecqi9/baTWJSc+/2Ts0A1Tz4r6f4ii6MS6g kedTuwq706DgtXhcwmDaFG79sr5IWc+9sricMuYMP6m2ySWHnuyRQe+oNCwkFsCq 3Imr/IggynA5x8D1Tuffh6oUSyK42NWEcLMiW42MSPHV7rQUufdWBabfCdGyPzR2 pGdjyYcKWude4s2v+LNzLTPWUEGD8hyvPLXP0ns1pW/Rg8WjynE9tXiH7l+KDsn3 mUpz/ox8zHb9lm03M3YM5GLLiODRVvLcvyjeovMQW7aTJa6wV/ThoxVzN2SBUG9O NaEPXpNrzxtvjxuHkOvNGPgbaDFPAfzde4s6kb1JM6+Ktei7eOY= =03YF -----END PGP SIGNATURE----- --GvXjxJ+pjyke8COw--