Re: concerns around pg_lsn

From: Jeevan Ladhe <jeevan(dot)ladhe(at)enterprisedb(dot)com>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Developers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: concerns around pg_lsn
Date: 2019-07-31 11:56:42
Message-ID: CAOgcT0NSs2yO56kGf1qfVvXSS9KkK3G4R_dZKbPHeMOguxCD5w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Tue, Jul 30, 2019 at 6:06 PM Robert Haas <robertmhaas(at)gmail(dot)com> wrote:

> On Tue, Jul 30, 2019 at 4:52 AM Jeevan Ladhe
> <jeevan(dot)ladhe(at)enterprisedb(dot)com> wrote:
> > My only concern was something that we internally treat as invalid, why do
> > we allow, that as a valid value for that type. While I am not trying to
> > reinvent the wheel here, I am trying to understand if there had been any
> > idea behind this and I am missing it.
>
> Well, the word "invalid" can mean more than one thing. Something can
> be valid or invalid depending on context. I can't have -2 dollars in
> my wallet, but I could have -2 dollars in my bank account, because the
> bank will allow me to pay out slightly more money than I actually have
> on the idea that I will pay them back later (and with interest!). So
> as an amount of money in my wallet, -2 is invalid, but as an amount of
> money in my bank account, it is valid.
>
> 0/0 is not a valid LSN in the sense that (in current releases) we
> never write a WAL record there, but it's OK to compute with it.
> Subtracting '0/0'::pg_lsn seems useful as a way to convert an LSN to
> an absolute byte-index in the WAL stream.
>

Thanks Robert for such a nice and detailed explanation.
I now understand why LSN '0/0' can still be useful.

Regards,
Jeevan Ladhe

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2019-07-31 12:03:58 Re: partition routing layering in nodeModifyTable.c
Previous Message Peter Eisentraut 2019-07-31 11:54:31 Re: how to run encoding-dependent tests by default