You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2026/02/11 15:27:13 UTC

[PR] chore: Add memory reservation debug logging [datafusion-comet]

andygrove opened a new pull request, #3489:
URL: https://github.com/apache/datafusion-comet/pull/3489

   ## Which issue does this PR close?
   
   <!--
   We generally require a GitHub issue to be filed for all bug fixes and enhancements and this helps us generate change logs for our releases. You can link an issue to this PR using the GitHub syntax. For example `Closes #123` indicates that this PR will close issue #123.
   -->
   
   N/A - debugging improvement
   
   ## Rationale for this change
   
   When debugging memory reservation issues in Comet, it is helpful to see all memory pool interactions (grow, shrink, try_grow) with task IDs and consumer names. This PR adds a lightweight opt-in logging decorator for the native memory pool.
   
   ## What changes are included in this PR?
   
   - Add new config `spark.comet.debug.memory` (default: `false`)
   - Add new `LoggingPool` that wraps the existing memory pool when the config is enabled
   - Log all `grow`, `shrink`, and `try_grow` calls with task attempt ID, consumer name, and result (Ok/Err)
   - Add documentation for the new debugging feature
   
   Example output:
   ```
   [Task 486] MemoryPool[ExternalSorter[6]].try_grow(256232960) returning Ok
   [Task 486] MemoryPool[ExternalSorter[6]].try_grow(257820416) returning Err
   [Task 486] MemoryPool[ExternalSorterMerge[6]].shrink(10485760)
   ```
   
   ## How are these changes tested?
   
   Manual testing with TPC-DS/TPC-H benchmarks. The logging pool is a thin decorator that delegates all operations to the underlying pool, so it does not change any behavior.
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add memory reservation debug logging [datafusion-comet]

Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #3489:
URL: https://github.com/apache/datafusion-comet/pull/3489


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org


Re: [PR] chore: Add memory reservation debug logging [datafusion-comet]

Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #3489:
URL: https://github.com/apache/datafusion-comet/pull/3489#discussion_r2799590284


##########
native/core/src/execution/memory_pools/logging_pool.rs:
##########
@@ -0,0 +1,112 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+use datafusion::execution::memory_pool::{
+    MemoryConsumer, MemoryLimit, MemoryPool, MemoryReservation,
+};
+use log::{info, warn};
+use std::sync::Arc;
+
+#[derive(Debug)]
+pub(crate) struct LoggingPool {

Review Comment:
   ```suggestion
   pub(crate) struct LoggingMemoryPool {
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org