diff --git a/pageserver/src/tenant.rs b/pageserver/src/tenant.rs index 758f8b15a1..585a08e155 100644 --- a/pageserver/src/tenant.rs +++ b/pageserver/src/tenant.rs @@ -15,6 +15,7 @@ use anyhow::{bail, Context}; use camino::{Utf8Path, Utf8PathBuf}; use futures::FutureExt; use pageserver_api::models::TimelineState; +use pageserver_api::shard::ShardIdentity; use remote_storage::DownloadError; use remote_storage::GenericRemoteStorage; use storage_broker::BrokerClientChannel; @@ -169,6 +170,7 @@ pub struct TenantSharedResources { /// for an attached tenant is a subset of the [`LocationConf`], represented /// in this struct. pub(super) struct AttachedTenantConf { + shard: ShardIdentity, tenant_conf: TenantConfOpt, location: AttachedLocationConfig, } @@ -177,6 +179,7 @@ impl AttachedTenantConf { fn try_from(location_conf: LocationConf) -> anyhow::Result { match &location_conf.mode { LocationMode::Attached(attach_conf) => Ok(Self { + shard: location_conf.shard, tenant_conf: location_conf.tenant_conf, location: attach_conf.clone(), }), diff --git a/pageserver/src/tenant/timeline.rs b/pageserver/src/tenant/timeline.rs index bbb96cb172..d90758a560 100644 --- a/pageserver/src/tenant/timeline.rs +++ b/pageserver/src/tenant/timeline.rs @@ -12,8 +12,12 @@ use bytes::Bytes; use camino::{Utf8Path, Utf8PathBuf}; use fail::fail_point; use itertools::Itertools; -use pageserver_api::models::{ - DownloadRemoteLayersTaskInfo, DownloadRemoteLayersTaskSpawnRequest, LayerMapInfo, TimelineState, +use pageserver_api::{ + models::{ + DownloadRemoteLayersTaskInfo, DownloadRemoteLayersTaskSpawnRequest, LayerMapInfo, + TimelineState, + }, + shard::ShardIdentity, }; use serde_with::serde_as; use storage_broker::BrokerClientChannel; @@ -1310,6 +1314,11 @@ impl Timeline { .unwrap_or(self.conf.default_tenant_conf.gc_feedback) } + pub(crate) fn get_shard(&self) -> ShardIdentity { + let tenant_conf = &self.tenant_conf.read().unwrap(); + tenant_conf.shard.clone() + } + pub(super) fn tenant_conf_updated(&self) { // NB: Most tenant conf options are read by background loops, so, // changes will automatically be picked up. @@ -1538,6 +1547,7 @@ impl Timeline { .tenant_conf .max_lsn_wal_lag .unwrap_or(self.conf.default_tenant_conf.max_lsn_wal_lag); + let shard = tenant_conf_guard.shard.clone(); drop(tenant_conf_guard); let mut guard = self.walreceiver.lock().unwrap();