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

feat(pageserver): add an optional lease to the get_lsn_by_timestamp API #8104

Merged
merged 9 commits into from
Jun 24, 2024
3 changes: 3 additions & 0 deletions pageserver/src/http/routes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,9 @@ async fn get_lsn_by_timestamp_handler(
let lease = if with_lease && (kind == "present" || kind == "future") {
timeline
.make_lsn_lease(lsn, timeline.get_lsn_lease_length_for_ts(), &ctx)
.inspect_err(|_| {
info!("fail to grant a lease to {}", lsn);
yliang412 marked this conversation as resolved.
Show resolved Hide resolved
})
.ok()
yliang412 marked this conversation as resolved.
Show resolved Hide resolved
} else {
None
Expand Down
4 changes: 2 additions & 2 deletions test_runner/fixtures/pageserver/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,9 +634,9 @@ def timeline_get_lsn_by_timestamp(
**kwargs,
):
log.info(
f"Requesting lsn by timestamp {timestamp}, tenant {tenant_id}, timeline {timeline_id}, with_lease={with_lease}"
f"Requesting lsn by timestamp {timestamp}, tenant {tenant_id}, timeline {timeline_id}, {with_lease=}"
)
with_lease_query = f"with_lease={with_lease}".lower()
with_lease_query = f"{with_lease=}".lower()
res = self.get(
f"http://localhost:{self.port}/v1/tenant/{tenant_id}/timeline/{timeline_id}/get_lsn_by_timestamp?timestamp={timestamp.isoformat()}Z&{with_lease_query}",
**kwargs,
Expand Down
Loading