Skip to content

Commit

Permalink
add more comment
Browse files Browse the repository at this point in the history
Signed-off-by: jayzhan211 <[email protected]>
  • Loading branch information
jayzhan211 committed Oct 29, 2024
1 parent 905eea7 commit 98135ee
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions datafusion/execution/src/memory_pool/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,10 @@ impl MemoryPool for UnboundedMemoryPool {
#[derive(Debug)]
pub struct GreedyMemoryPool {
pool_size: usize,
// Pool size limit for each consumer, if one of the consumer exceeds the limit, error is returned
pool_size_per_consumer: HashMap<String, usize>,
used: AtomicUsize,
// Memory usage for each consumer, used to check aginst `pool_size_per_consumer`
used_per_consumer: RwLock<HashMap<String, AtomicUsize>>,
}

Expand Down
10 changes: 10 additions & 0 deletions datafusion/physical-plan/src/sorts/sort_preserving_merge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -409,13 +409,23 @@ mod tests {
}

#[tokio::test(flavor = "multi_thread")]
/// This test verifies that memory usage stays within limits when the tie breaker is enabled.
/// Any errors here could indicate unintended changes in tie breaker logic.
///
/// Note: If you adjust constants in this test, ensure that memory usage differs
/// based on whether the tie breaker is enabled or disabled.
async fn test_round_robin_tie_breaker_success() -> Result<()> {
let task_ctx = generate_task_ctx_for_round_robin_tie_breaker()?;
let spm = generate_spm_for_round_robin_tie_breaker(true)?;
let _collected = collect(spm, task_ctx).await.unwrap();
Ok(())
}

/// This test verifies that memory usage stays within limits when the tie breaker is enabled.
/// Any errors here could indicate unintended changes in tie breaker logic.
///
/// Note: If you adjust constants in this test, ensure that memory usage differs
/// based on whether the tie breaker is enabled or disabled.
#[tokio::test(flavor = "multi_thread")]
async fn test_round_robin_tie_breaker_fail() -> Result<()> {
let task_ctx = generate_task_ctx_for_round_robin_tie_breaker()?;
Expand Down

0 comments on commit 98135ee

Please sign in to comment.