houqp commented on a change in pull request #1526: URL: https://github.com/apache/arrow-datafusion/pull/1526#discussion_r780701856
########## File path: datafusion/src/execution/memory_manager.rs ########## @@ -0,0 +1,320 @@ +// 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. + +//! Manages all available memory during query execution + +use crate::error::Result; +use async_trait::async_trait; +use hashbrown::HashMap; +use log::info; +use std::fmt; +use std::fmt::{Debug, Display, Formatter}; +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::sync::{Arc, Mutex}; +use std::time::Duration; +use tokio::task; +use tokio::task::JoinHandle; + +static mut CONSUMER_ID: AtomicUsize = AtomicUsize::new(0); + +fn next_id() -> usize { + unsafe { CONSUMER_ID.fetch_add(1, Ordering::SeqCst) } +} + +/// Type of the memory consumer +pub enum ConsumerType { + /// consumers that can grow or shrink its memory usage during execution Review comment: Ha, ok, this explanation makes a lot more sense to me now. When I initially read the comment, I was thinking `consumers themselves can grow or shrink`. So perhaps we can just reword it to `consumers that can be controlled by memory manager to grow and shrink`. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
