This is an automated email from the ASF dual-hosted git repository.
tustvold pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git
The following commit(s) were added to refs/heads/master by this push:
new f0c095802 Fix FairSpillPool try_grow for non-spillable consumers
(#5160)
f0c095802 is described below
commit f0c095802f292dbee891712f31bfd20d32b54336
Author: Raphael Taylor-Davies <[email protected]>
AuthorDate: Thu Feb 2 12:46:36 2023 +0000
Fix FairSpillPool try_grow for non-spillable consumers (#5160)
---
datafusion/core/src/execution/memory_pool/pool.rs | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/datafusion/core/src/execution/memory_pool/pool.rs
b/datafusion/core/src/execution/memory_pool/pool.rs
index 5d28629be..97dc7c2e5 100644
--- a/datafusion/core/src/execution/memory_pool/pool.rs
+++ b/datafusion/core/src/execution/memory_pool/pool.rs
@@ -190,7 +190,7 @@ impl MemoryPool for FairSpillPool {
false => {
let available = self
.pool_size
- .saturating_sub(state.unspillable + state.unspillable);
+ .saturating_sub(state.unspillable + state.spillable);
if available < additional {
return Err(insufficient_capacity_err(
@@ -281,5 +281,13 @@ mod tests {
drop(r2);
assert_eq!(pool.reserved(), 20);
r3.try_grow(80).unwrap();
+
+ assert_eq!(pool.reserved(), 100);
+ r1.free();
+ assert_eq!(pool.reserved(), 80);
+
+ let mut r4 = MemoryConsumer::new("s4").register(&pool);
+ let err = r4.try_grow(30).unwrap_err().to_string();
+ assert_eq!(err, "Resources exhausted: Failed to allocate additional 30
bytes for s4 with 0 bytes already allocated - maximum available is 20");
}
}