Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 6 additions & 15 deletions datafusion/core/src/execution/memory_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,21 +288,12 @@ impl MemoryManager {
}

pub(crate) fn shrink_tracker_usage(&self, delta: usize) {
let update =
self.trackers_total
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| {
if x >= delta {
Some(x - delta)
} else {
None
}
});
update.unwrap_or_else(|_| {
panic!(
"Tracker total memory shrink by {} underflow, current value is ",
delta
)
});
self.trackers_total
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |x| {
// Do not panic, set to usize::MIN on underflow
Some(x.saturating_sub(delta))
})
.expect("Unexpected underflow in tracker memory usage");
}

fn get_requester_total(&self) -> usize {
Expand Down