feat: add needed budget and memory budget into the message for us to diagnose and increase our memory budget as needed (#5640)

pull/24376/head
Nga Tran 2022-09-14 12:06:19 -04:00 committed by GitHub
parent 8b273c2a7d
commit 44e12aa512
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 3 deletions

View File

@ -392,7 +392,10 @@ mod tests {
let skipped_compactions = repos.partitions().list_skipped_compactions().await.unwrap();
assert_eq!(skipped_compactions.len(), 1);
assert_eq!(skipped_compactions[0].partition_id, partition4.partition.id);
assert_eq!(skipped_compactions[0].reason, "over memory budget");
assert_eq!(
skipped_compactions[0].reason,
"over memory budget. Needed budget = 15750, memory budget = 13500"
);
}
}

View File

@ -175,7 +175,8 @@ async fn compact_candidates_with_memory_budget<C, Fut>(
}
}
FilterResult::OverBudget => {
if to_compact.budget_bytes() <= compactor.config.memory_budget_bytes {
let needed_bytes = to_compact.budget_bytes();
if needed_bytes <= compactor.config.memory_budget_bytes {
// Required budget is larger than the remaining budget but smaller than
// full budget, add this partition back to the end of the list to compact
// with full budget later
@ -186,12 +187,18 @@ async fn compact_candidates_with_memory_budget<C, Fut>(
?partition_id,
?table_id,
compaction_type,
?needed_bytes,
memory_budget_bytes = compactor.config.memory_budget_bytes,
"skipped; over memory budget"
);
let mut repos = compactor.catalog.repositories().await;
let reason = format!(
"over memory budget. Needed budget = {}, memory budget = {}",
needed_bytes, compactor.config.memory_budget_bytes
);
let record_skip = repos
.partitions()
.record_skipped_compaction(partition_id, "over memory budget")
.record_skipped_compaction(partition_id, &reason)
.await;
if let Err(e) = record_skip {
warn!(?partition_id, %e, "could not log skipped compaction");