From: Michael Paquier <michael@paquier.xyz>
To: Andres Freund <andres@anarazel.de>
Cc: Scott Stroupe <sstroupe@kofile.net>
Cc: pgsql-general@postgresql.org
Subject: Re: Print pg_lsn as a number?
Date: Wed, 13 Jun 2018 09:18:21 +0900
Message-ID: <20180613001821.GC3138@paquier.xyz> (raw)
In-Reply-To: <20180612173943.rkzhfcjzaipjvs4n@alap3.anarazel.de>
References: <B7E970C2-6453-4E0C-BD97-22FAD313AF00@kofile.net>
<20180612173943.rkzhfcjzaipjvs4n@alap3.anarazel.de>
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?
>
> 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 = pg_lsn.
pg_lsn % numeric = 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
Attachments:
signature.asc (application/pgp-signature, 832B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: michael@paquier.xyz, andres@anarazel.de, sstroupe@kofile.net
Subject: Re: Print pg_lsn as a number?
In-Reply-To: <20180613001821.GC3138@paquier.xyz>
References: <B7E970C2-6453-4E0C-BD97-22FAD313AF00@kofile.net> <20180612173943.rkzhfcjzaipjvs4n@alap3.anarazel.de> <20180613001821.GC3138@paquier.xyz>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox