Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API to request the timestamp for given LSN #5468

Closed
arpad-m opened this issue Oct 4, 2023 · 1 comment · Fixed by #5497
Closed

API to request the timestamp for given LSN #5468

arpad-m opened this issue Oct 4, 2023 · 1 comment · Fixed by #5497
Assignees
Labels
c/storage/pageserver Component: storage: pageserver t/feature Issue type: feature, for new features or requests

Comments

@arpad-m
Copy link
Member

arpad-m commented Oct 4, 2023

On slack, @xenomote has asked for an API for the pageserver to obtain the timestamp corresponding to a given LSN.

For the use case, they write:

when a branch is created by LSN instead of timestamp we currently have no relevant timestamp available to display

The slack thread discusses either returning always also the timestamp in addition to the lsn, say for when we return TimelineInfo from /v1/tenant/{tenant_id}/timeline, or alternatively providing an endpoint like /v1/tenant/{tenant_id}/timeline/{timeline_id}/get_lsn_by_timestamp, just the other way around.

@jcsp has pointed out that computing the timestamp might be non trivial and has suggested the following:

just providing an on-demand API to get timestamp at the start_lsn of a timeline seems like the least-effort way forward.

@arpad-m arpad-m added t/feature Issue type: feature, for new features or requests c/storage/pageserver Component: storage: pageserver labels Oct 4, 2023
@arpad-m arpad-m self-assigned this Oct 4, 2023
@arpad-m
Copy link
Member Author

arpad-m commented Oct 5, 2023

I had a look at the code. It should be pretty easy to traverse the timestamps corresponding to the LSN and then returning the minimum and maximum from the range. We can also run other methods on it, like determining the mean, average, etc. I want to file a PR by the end of the week.

arpad-m added a commit that referenced this issue Oct 19, 2023
## Problem

See #5468.

## Summary of changes

Add a new `get_timestamp_of_lsn` endpoint, returning the timestamp
associated with the given lsn.

Fixes #5468.

---------

Co-authored-by: Shany Pozin <shany@neon.tech>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c/storage/pageserver Component: storage: pageserver t/feature Issue type: feature, for new features or requests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant