Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fStUj-0004dH-Vs for pgsql-general@arkaria.postgresql.org; Wed, 13 Jun 2018 00:18:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fStUi-0008Ix-Mo for pgsql-general@arkaria.postgresql.org; Wed, 13 Jun 2018 00:18:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fStUi-0008Im-Ed for pgsql-general@lists.postgresql.org; Wed, 13 Jun 2018 00:18:36 +0000 Received: from out1-smtp.messagingengine.com ([66.111.4.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fStUZ-0005Ak-LH for pgsql-general@postgresql.org; Wed, 13 Jun 2018 00:18:35 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 9636521BAB; Tue, 12 Jun 2018 20:18:26 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Tue, 12 Jun 2018 20:18:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=paquier.xyz; h= cc:content-type:date:from:in-reply-to:message-id:mime-version :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=8ABNH1MtkDl5UbDf03X6fmtsVyGTnnVO7buWladTSlk=; b=EY5CiOuT ZlovQ/OwoWZy0RUv6ByEfDNfIKO+kNES9Xuvh+gpO+V6naKsfj6X+wKYpUf08Vve rrn7txeGTknWL0HSKcVkJ/XS++qLaJRrp+199XECMss3T6M5SzZfSAobqQQWOtOd BeTL/K9ZAayx4cDBH/sPvLEsRyriJFcC+NbHD+e4ALh5Fhkel5bPqP5JAdlGCzB9 t72KZV0yeYqPI94e7gNKKhrKhAaR5fq0aCOik0MnFZAIQdSeqClSQumJAAls/Kuk wgbokZXZIMZTDO0VTfEVhGUzlX1u8QcMYT4ISVN6MwWrSnDeOls3CirT6SXprcrX euLASZIzbBJ+6g== 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-sender :x-me-sender:x-sasl-enc; s=fm3; bh=8ABNH1MtkDl5UbDf03X6fmtsVyGTn nVO7buWladTSlk=; b=CSnWvB3qLiwa7MSy39nZ5InayWfnwnFv/xSBAJu4H3i2+ NNAzqNZKdcxQajH/U/X/JCEarRjls5ci/tLgN0IhVH3eXjlz529SQI73Om5/hKZz +Q97m2+HYDDaNqDn5o+VdtR9YEkTFJ7VYm2MJhaUOe1Uko8nr6gTSneY4egl/D19 u8D083BE3l2QwoRlrn3QquoaptnVvjLYd/qrxKGKaIGZbsHxqDfD/U97Yp3JcH2n W2/aRtPKF6AfjTbGRoQ0Y1VJKpQeUdgSERNvvucrGt3nBPPzkhDpueJLH9U9+Jqv a4m+6/ynpjpHiarvhYzyVcxt0iY5xGKs6fqTOeWWg== X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Proxy: X-ME-Sender: Received: from paquier.xyz (c137162.net61215.cablenet.ne.jp [61.215.137.162]) by mail.messagingengine.com (Postfix) with ESMTPA id CB249E4154; Tue, 12 Jun 2018 20:18:24 -0400 (EDT) Date: Wed, 13 Jun 2018 09:18:21 +0900 From: Michael Paquier To: Andres Freund Cc: Scott Stroupe , pgsql-general@postgresql.org Subject: Re: Print pg_lsn as a number? Message-ID: <20180613001821.GC3138@paquier.xyz> References: <20180612173943.rkzhfcjzaipjvs4n@alap3.anarazel.de> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="HG+GLK89HZ1zG0kk" Content-Disposition: inline In-Reply-To: <20180612173943.rkzhfcjzaipjvs4n@alap3.anarazel.de> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --HG+GLK89HZ1zG0kk Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jun 12, 2018 at 10:39:43AM -0700, Andres Freund wrote: > On 2018-06-12 09:31:49 -0700, Scott Stroupe wrote: >> According to the documentation[1], pg_lsn is a 64-bit integer that's >> printed as two hex numbers separated by a slash, e.g. 68/1225BB70. Is >> there a way to get the 64-bit integer in a common numeric >> representation instead of the peculiar hex-slash-hex representation? >=20 > What do you want to do with the LSN? While fixing the slot advance stuff, I would have liked to get an automatic test able to reproduce the crash where the slot is first advanced at a page boundary, and then again moved forward. However it happens that it is not that easy to do so, so I would be rather supportive to at least the following operations: pg_lsn + numeric =3D pg_lsn. pg_lsn % numeric =3D numeric. We map pg_wal_lsn_diff result to a numeric, so that could make sense to use numeric as well here, which is not the greatest choice by the way as that's an int64 internally, but that's more portable for any (unlikely-to-happen) future changes. Using the segment size value in pg_settings, you could also advance the LSN worth a full segment for example... -- Michael --HG+GLK89HZ1zG0kk Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEG72nH6vTowiyblFKnvQgOdbyQH0FAlsgYs0ACgkQnvQgOdby QH04JRAAhKL/J4pNg+Mz8B30w4fB5Nt01kRmK86D/S/tGozND4pfc4f0MHBpLvni SC8/O3TNyyHkXBoEYM/sO+gYj8tY6Btl2ChChaT/SY+4wQCjNbY3jkEUGav6sqzh 9821s0HncnN5um1a6LuVl/5Sa5lWqpnrFNjP1wB5HFfj464PryKVa4dQh9XBr/cO cR/tMmBm6BEXqGjBmZBVI3vyPQfbvZFYXVFHb27lp3znXnVk4epi+138ZN+J5GWG nYkruiIkSBPBfbTv+zVhUWRoUpMsukpBsq9uaVRIAfxcVbpzG/E7AN2hU1d3xQU2 WoBRtUMbY6B1ecUqtVejTlVHTrWndv5rdSU0XjYMH6FTpAh5L3Vj3beizDzbToFh gJJ6IR679W6Ba/KwFG9sz3Nwl4dCRznMJE1Y5xVURBzTaEny7B0OWpY6e0YWUV4S +C6EJX2U54cHSDo69R0YEhXcF9Fz8NK9InvUAzHTQzTKvJwplD+8yqiOg1V7QwGd WCaeVDx9e5HsGELHIgNfrGCQIjQt3DrN60yhgmNaxz9xYPr3ro231KmREjYIN5cQ mjZ/FfF9sBzL3olBkfiZl3Bn9lf8VUXy4LyDEzEto39uW/0thrsvgf0Krck6Yg1I CFKsCC0F7ml5HKOinSWvcXcJouus3iAZ2nXlMriOVcEkttWOC4A= =5+1b -----END PGP SIGNATURE----- --HG+GLK89HZ1zG0kk--