Skip to content

Commit

Permalink
fix partition id
Browse files Browse the repository at this point in the history
  • Loading branch information
yjshen committed Jan 4, 2022
1 parent 0f5e377 commit 0843c77
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@

//! Execution Memory Pool that guarantees a memory allocation strategy

use crate::execution::memory_management::MemoryConsumerId;
use async_trait::async_trait;
use hashbrown::HashMap;
use log::{info, warn};
Expand Down Expand Up @@ -189,7 +188,7 @@ impl MemoryAllocationStrategist for FairStrategist {
if to_grant < required && current_mem + to_grant < min_memory_per_partition {
info!(
"{:?} waiting for at least 1/2N of pool to be free",
consumer
partition_id
);
let _ = self.notify.notified().await;
} else {
Expand All @@ -214,12 +213,12 @@ impl MemoryAllocationStrategist for FairStrategist {
} else {
let mut partition_usage = self.memory_usage.write().await;
if granted_size > real_size {
*partition_usage.entry(consumer.partition_id).or_insert(0) -=
*partition_usage.entry(partition_id).or_insert(0) -=
granted_size - real_size;
} else {
// TODO: this would have caused OOM already if size estimation ahead is much smaller than
// that of actual allocation
*partition_usage.entry(consumer.partition_id).or_insert(0) +=
*partition_usage.entry(partition_id).or_insert(0) +=
real_size - granted_size;
}
}
Expand Down
2 changes: 1 addition & 1 deletion datafusion/src/execution/memory_management/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl MemoryManager {
consumer: &MemoryConsumerId,
) {
self.strategist
.update_usage(granted_size, real_size, consumer)
.update_usage(granted_size, real_size, consumer.partition_id)
.await
}

Expand Down

0 comments on commit 0843c77

Please sign in to comment.