The arrow-java C-Data importer retains a native batch reference before
calling allocateBytes. If the target allocator is bounded and throws
OutOfMemoryException mid-array, the refcount stays elevated, the C-Data
release callback never fires, and the native batch leaks permanently.
POOL_QUERY is now registered as a special unmanaged pool (Long.MAX_VALUE,
excluded from the rebalancer and budget validation) so imports can never
OOM mid-array. Real memory enforcement lives Rust-side (DataFusion
MemoryPool + RSS-pressure gate). The pool.query.max and pool.query.min
settings are deprecated — they had no effect once the pool is unmanaged.
Reverts the per-batch staging workaround from opensearch-project#22448 (DatafusionResultStream,
LuceneResultStream) and removes DatafusionImportLeakTests — those were a
temporary mitigation. With POOL_QUERY permanently unbounded the trigger
cannot fire, making the staging path unnecessary. The definitive fix for
the underlying arrow-java bug is apache/arrow-java#1240.
Signed-off-by: Sandesh Kumar <sandeshkr419@gmail.com>
The arrow-java C-Data importer retains a native batch reference before calling allocateBytes. If POOL_QUERY is bounded and throws OutOfMemoryException mid-array, the refcount stays elevated, the C-Data release callback never fires, and the native batch leaks permanently. These bytes are zero-copy foreign wraps of pre-existing native memory — the Java-side limit guarded nothing physical; real enforcement lives Rust-side (DataFusion MemoryPool → CircuitBreakingException → 429).
POOL_QUERY is now registered as a special unmanaged pool: fixed at Long.MAX_VALUE, excluded from the rebalancer, budget validation, and pool-group limit sums. The pool.query.max and pool.query.min settings are deprecated — they have no effect and log a warning if configured.
This also reverts the per-batch staging workaround from #22448. That workaround prevented the trigger by routing imports through an unbounded root child; with POOL_QUERY permanently unbounded the trigger cannot fire, making the staging path unnecessary. The definitive upstream fix for the arrow-java bug is bug: apache/arrow-java#1239 pr: apache/arrow-java#1240.
Tested on a single-node cluster and 2 node cluster with 3 shard setup:
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.