storage controller: upload heatmaps at end of shard split

This commit is contained in:
John Spray
2024-03-28 14:44:45 +00:00
parent 8d06a28350
commit 6d2a752dac
3 changed files with 28 additions and 0 deletions
@@ -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!(
+11
View File
@@ -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,