Skip to content

Commit

Permalink
chore: log memory reservations
Browse files Browse the repository at this point in the history
  • Loading branch information
wiedld committed Sep 11, 2024
1 parent c6c7a73 commit 7b18895
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion datafusion/execution/src/memory_pool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
// under the License.

use crate::memory_pool::{MemoryConsumer, MemoryPool, MemoryReservation};
use chrono::Utc;
use datafusion_common::{resources_datafusion_err, DataFusionError, Result};
use hashbrown::HashMap;
use log::debug;
Expand Down Expand Up @@ -301,7 +302,8 @@ impl<I: MemoryPool> TrackConsumersPool<I> {
)
})
.collect::<Vec<_>>();
consumers.sort_by(|a, b| b.1.cmp(&a.1)); // inverse ordering
// consumers.sort_by(|a, b| b.1.cmp(&a.1)); // inverse ordering
consumers.sort_by(|a, b| b.0.cmp(&a.0)); // sort by name, make stdout easily parsible

consumers[0..std::cmp::min(top, consumers.len())]
.iter()
Expand Down Expand Up @@ -346,6 +348,8 @@ impl<I: MemoryPool> MemoryPool for TrackConsumersPool<I> {
.and_modify(|bytes| {
bytes.fetch_add(additional as u64, Ordering::AcqRel);
});

println!("REPORT: {}, {}", Utc::now(), self.report_top(5));
}

fn shrink(&self, reservation: &MemoryReservation, shrink: usize) {
Expand Down Expand Up @@ -380,6 +384,8 @@ impl<I: MemoryPool> MemoryPool for TrackConsumersPool<I> {
.and_modify(|bytes| {
bytes.fetch_add(additional as u64, Ordering::AcqRel);
});
println!("REPORT: {}, {}", Utc::now(), self.report_top(5));

Ok(())
}

Expand Down

0 comments on commit 7b18895

Please sign in to comment.