Re: Add LSN <-> time conversion functionality

From: Melanie Plageman <melanieplageman(at)gmail(dot)com>
To: Daniel Gustafsson <daniel(at)yesql(dot)se>
Cc: Tomas Vondra <tomas(dot)vondra(at)enterprisedb(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>, Robert Haas <robertmhaas(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Subject: Re: Add LSN <-> time conversion functionality
Date: 2024-06-28 22:09:23
Message-ID: CAAKRu_b-X_BDieA23r2vq_nzYcPvvs22MDpiZw_y8cS7yGFk7A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Jun 26, 2024 at 10:04 PM Melanie Plageman
<melanieplageman(at)gmail(dot)com> wrote:
>
> I've implemented these review points in the attached v4.

I realized the docs had a compilation error. Attached v5 fixes that as
well as three bugs I found while using this patch set more intensely
today.

I see Michael has been working on some crash safety for stats here
[1]. I wonder if that would be sufficient for the LSNTimeStream. I
haven't examined his patch functionality yet, though.

I also had an off-list conversation with Robert where he suggested I
could perhaps change the user-facing functions for estimating an
LSN/time conversion to instead return a floor and a ceiling -- instead
of linearly interpolating a guess. This would be a way to keep users
from misunderstanding the accuracy of the functions to translate LSN
<-> time. I'm interested in what others think of this.

I like this idea a lot because it allows me to worry less about how I
decide to compress the data and whether or not it will be accurate for
use cases different than my own (the opportunistic freezing
heuristic). If I can provide a floor and a ceiling that are definitely
accurate, I don't have to worry about misleading people.

- Melanie

[1] https://www.postgresql.org/message-id/ZnEiqAITL-VgZDoY%40paquier.xyz

Attachment Content-Type Size
v5-0002-Add-LSNTimeStream-for-converting-LSN-time.patch text/x-patch 10.5 KB
v5-0004-Bgwriter-maintains-global-LSNTimeStream.patch text/x-patch 1.6 KB
v5-0001-Record-LSN-at-postmaster-startup.patch text/x-patch 2.6 KB
v5-0005-Add-time-LSN-translation-functions.patch text/x-patch 6.6 KB
v5-0003-Add-LSNTimeStream-to-PgStat_WalStats.patch text/x-patch 1.8 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2024-06-28 22:11:39 Re: Restart pg_usleep when interrupted
Previous Message Melanie Plageman 2024-06-28 21:36:25 Re: Confine vacuum skip logic to lazy_scan_skip