mirror of
https://github.com/neondatabase/neon.git
synced 2026-10-19 18:23:08 +00:00
storage controller: upload heatmaps at end of shard split
This commit is contained in:
@@ -101,6 +101,15 @@ impl PageserverClient {
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) async fn tenant_heatmap_upload(&self, tenant_id: TenantShardId) -> Result<()> {
|
||||
measured_request!(
|
||||
"tenant_heatmap_upload",
|
||||
crate::metrics::Method::Post,
|
||||
&self.node_id_label,
|
||||
self.inner.tenant_heatmap_upload(tenant_id).await
|
||||
)
|
||||
}
|
||||
|
||||
pub(crate) async fn location_config(
|
||||
&self,
|
||||
tenant_shard_id: TenantShardId,
|
||||
|
||||
@@ -3409,6 +3409,14 @@ impl Service {
|
||||
.join(",")
|
||||
);
|
||||
|
||||
// Optimization: publish heatmaps immediately, so that secondary locations can start warming up.
|
||||
for child in child_ids {
|
||||
if let Err(e) = client.tenant_heatmap_upload(*child).await {
|
||||
// Non-fatal, this is just an optimization
|
||||
tracing::warn!("Failed to upload child {child} heatmap: {e}");
|
||||
}
|
||||
}
|
||||
|
||||
if &response.new_shards != child_ids {
|
||||
// This should never happen: the pageserver should agree with us on how shard splits work.
|
||||
return Err(ApiError::InternalServerError(anyhow::anyhow!(
|
||||
|
||||
@@ -271,6 +271,17 @@ impl Client {
|
||||
Ok((status, progress))
|
||||
}
|
||||
|
||||
pub async fn tenant_heatmap_upload(&self, tenant_id: TenantShardId) -> Result<()> {
|
||||
let path = reqwest::Url::parse(&format!(
|
||||
"{}/v1/tenant/{}/heatmap_upload",
|
||||
self.mgmt_api_endpoint, tenant_id
|
||||
))
|
||||
.expect("Cannot build URL");
|
||||
|
||||
self.request(Method::POST, path, ()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn location_config(
|
||||
&self,
|
||||
tenant_shard_id: TenantShardId,
|
||||
|
||||
Reference in New Issue
Block a user