code cleanup

This commit is contained in:
Anastasia Lubennikova
2023-01-12 20:28:23 +02:00
parent 5e3e0fbf6f
commit c6d383e239
2 changed files with 5 additions and 9 deletions

View File

@@ -379,15 +379,10 @@ pub async fn calculate_synthetic_size_worker(
continue;
}
match mgr::get_tenant(tenant_id, true).await
if let Ok(tenant) = mgr::get_tenant(tenant_id, true).await
{
Ok(tenant) => {
if let Err(e) = tenant.calculate_synthetic_size().await {
error!("failed to calculate synthetic size for tenant {}: {}", tenant_id, e);
}
},
Err(err) => {
error!("tenant {} is not found: {err:?}", tenant_id);
if let Err(e) = tenant.calculate_synthetic_size().await {
error!("failed to calculate synthetic size for tenant {}: {}", tenant_id, e);
}
}

View File

@@ -52,7 +52,6 @@ struct TimelineInputs {
// need to sort them in the tree order.
//
// see updates_sort_with_branches_at_same_lsn test below
fn sort_updates_in_tree_order(updates: Vec<Update>) -> anyhow::Result<Vec<Update>> {
let mut sorted_updates = Vec::with_capacity(updates.len());
let mut known_timelineids = HashSet::new();
@@ -380,6 +379,8 @@ pub(super) async fn gather_inputs(
// handled by the variant order in `Command`.
//
updates.sort_unstable();
// And another sort to handle Command::BranchFrom ordering
// in case when there are multiple branches at the same LSN.
let sorted_updates = sort_updates_in_tree_order(updates)?;
let retention_period = match max_cutoff_distance {