Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix memory usage in plan_to_object_store #71

Merged
merged 11 commits into from
Aug 30, 2022
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ hashbrown = { version = "0.12", features = ["raw"] }
hex = ">=0.4.0"
itertools = ">=0.10.0"
log = "0.4"
mimalloc = { version = "*", default-features = false }
moka = { version = "0.9.3", default_features = false, features = ["future", "atomic64", "quanta"] }
object_store = "0.3.0"
pretty_env_logger = "0.4"
Expand Down
26 changes: 6 additions & 20 deletions docs/static/logotype.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 9 additions & 4 deletions src/config/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,11 @@ use object_store::{local::LocalFileSystem, memory::InMemory, ObjectStore};
use crate::repository::postgres::PostgresRepository;

use crate::object_store::http::add_http_object_store;
use crate::object_store::wrapped::InternalObjectStore;
#[cfg(feature = "object-store-s3")]
use object_store::aws::new_s3;

use super::schema::{self, MEMORY_FRACTION, S3};
use super::schema::{self, MEBIBYTES, MEMORY_FRACTION, S3};

async fn build_catalog(
config: &schema::SeafowlConfig,
Expand Down Expand Up @@ -87,8 +88,8 @@ pub async fn build_context(
) -> Result<DefaultSeafowlContext, DataFusionError> {
let mut runtime_config = RuntimeConfig::new();
if let Some(max_memory) = cfg.runtime.max_memory {
runtime_config =
runtime_config.with_memory_limit(max_memory as usize, MEMORY_FRACTION);
runtime_config = runtime_config
.with_memory_limit((max_memory * MEBIBYTES) as usize, MEMORY_FRACTION);
}

if let Some(temp_dir) = &cfg.runtime.temp_dir {
Expand All @@ -108,7 +109,7 @@ pub async fn build_context(
context.runtime_env().register_object_store(
INTERNAL_OBJECT_STORE_SCHEME,
"",
object_store,
object_store.clone(),
);

// Register the HTTP object store for external tables
Expand Down Expand Up @@ -141,6 +142,10 @@ pub async fn build_context(
table_catalog: tables,
partition_catalog: partitions,
function_catalog: functions,
internal_object_store: Arc::new(InternalObjectStore {
inner: object_store,
config: cfg.object_store.clone(),
}),
database: DEFAULT_DB.to_string(),
database_id: default_db,
max_partition_size: cfg.misc.max_partition_size,
Expand Down
Loading