mirror of
https://github.com/neondatabase/neon.git
synced 2026-05-18 13:40:37 +00:00
have claude generate plumbing for standby_horizon_lease_length
This commit is contained in:
@@ -4213,6 +4213,19 @@ impl TenantShard {
|
||||
.unwrap_or(conf.default_tenant_conf.lsn_lease_length)
|
||||
}
|
||||
|
||||
pub fn get_standby_horizon_lease_length(&self) -> Duration {
|
||||
Self::get_standby_horizon_lease_length_impl(self.conf, &self.tenant_conf.load().tenant_conf)
|
||||
}
|
||||
|
||||
pub fn get_standby_horizon_lease_length_impl(
|
||||
conf: &'static PageServerConf,
|
||||
tenant_conf: &pageserver_api::models::TenantConfig,
|
||||
) -> Duration {
|
||||
tenant_conf
|
||||
.standby_horizon_lease_length
|
||||
.unwrap_or(conf.default_tenant_conf.standby_horizon_lease_length)
|
||||
}
|
||||
|
||||
pub fn get_timeline_offloading_enabled(&self) -> bool {
|
||||
if self.conf.timeline_offloading {
|
||||
return true;
|
||||
@@ -8876,15 +8889,15 @@ mod tests {
|
||||
],
|
||||
// image layers
|
||||
vec![
|
||||
(Lsn(0x10), vec![(key1, test_img("metadata key 1"))]),
|
||||
(
|
||||
Lsn(0x30),
|
||||
vec![
|
||||
(key0, test_img("metadata key 0")),
|
||||
(key3, test_img("metadata key 3")),
|
||||
],
|
||||
),
|
||||
],
|
||||
(Lsn(0x10), vec![(key1, test_img("metadata key 1"))]),
|
||||
(
|
||||
Lsn(0x30),
|
||||
vec![
|
||||
(key0, test_img("metadata key 0")),
|
||||
(key3, test_img("metadata key 3")),
|
||||
],
|
||||
),
|
||||
],
|
||||
Lsn(0x30),
|
||||
)
|
||||
.await?;
|
||||
|
||||
@@ -1886,7 +1886,7 @@ impl Timeline {
|
||||
}
|
||||
let applied_gc_cutoff_lsn =
|
||||
todo!("think about boundary conditions? we didn't have any before though");
|
||||
let length = todo!("duplicate init lease deadline logic?");
|
||||
let length = self.get_standby_horizon_lease_length();
|
||||
self.standby_horizons
|
||||
.upsert_lease(lease_id, lsn, length)
|
||||
.map(|lease| lease.valid_until)
|
||||
@@ -2669,6 +2669,14 @@ impl Timeline {
|
||||
.unwrap_or(self.conf.default_tenant_conf.lsn_lease_length_for_ts)
|
||||
}
|
||||
|
||||
pub(crate) fn get_standby_horizon_lease_length(&self) -> Duration {
|
||||
let tenant_conf = self.tenant_conf.load();
|
||||
tenant_conf
|
||||
.tenant_conf
|
||||
.standby_horizon_lease_length
|
||||
.unwrap_or(self.conf.default_tenant_conf.standby_horizon_lease_length)
|
||||
}
|
||||
|
||||
pub(crate) fn is_gc_blocked_by_lsn_lease_deadline(&self) -> bool {
|
||||
let tenant_conf = self.tenant_conf.load();
|
||||
tenant_conf.is_gc_blocked_by_lsn_lease_deadline()
|
||||
|
||||
Reference in New Issue
Block a user