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: don't count file cache buffer pool size if disabled #12941

Merged
merged 1 commit into from
Oct 18, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 35 additions & 16 deletions src/compute/src/memory_management/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -163,22 +163,30 @@ pub fn storage_memory_config(
//
// Adding more buffers can prevent allocators from waiting for buffers to be freed by flushers.

let data_file_cache_buffer_pool_capacity_mb = storage_config
.data_file_cache
.buffer_pool_size_mb
.unwrap_or(
storage_config.data_file_cache.file_capacity_mb
* (storage_config.data_file_cache.flushers
+ 2 * (1 << storage_config.data_file_cache.allocation_bits)),
);
let meta_file_cache_buffer_pool_capacity_mb = storage_config
.meta_file_cache
.buffer_pool_size_mb
.unwrap_or(
storage_config.meta_file_cache.file_capacity_mb
* (storage_config.meta_file_cache.flushers
+ 2 * (1 << storage_config.meta_file_cache.allocation_bits)),
);
let data_file_cache_buffer_pool_capacity_mb = if storage_config.data_file_cache.dir.is_empty() {
0
} else {
storage_config
.data_file_cache
.buffer_pool_size_mb
.unwrap_or(
storage_config.data_file_cache.file_capacity_mb
* (storage_config.data_file_cache.flushers
+ 2 * (1 << storage_config.data_file_cache.allocation_bits)),
)
};
let meta_file_cache_buffer_pool_capacity_mb = if storage_config.meta_file_cache.dir.is_empty() {
0
} else {
storage_config
.meta_file_cache
.buffer_pool_size_mb
.unwrap_or(
storage_config.meta_file_cache.file_capacity_mb
* (storage_config.meta_file_cache.flushers
+ 2 * (1 << storage_config.meta_file_cache.allocation_bits)),
)
};

let compactor_memory_limit_mb = storage_config.compactor_memory_limit_mb.unwrap_or(
((non_reserved_memory_bytes as f64 * compactor_memory_proportion).ceil() as usize) >> 20,
Expand Down Expand Up @@ -238,6 +246,17 @@ mod tests {
let mut storage_config = StorageConfig::default();
let total_non_reserved_memory_bytes = 8 << 30;

let memory_config =
storage_memory_config(total_non_reserved_memory_bytes, true, &storage_config);
assert_eq!(memory_config.block_cache_capacity_mb, 737);
assert_eq!(memory_config.meta_cache_capacity_mb, 860);
assert_eq!(memory_config.shared_buffer_capacity_mb, 737);
assert_eq!(memory_config.data_file_cache_buffer_pool_capacity_mb, 0);
assert_eq!(memory_config.meta_file_cache_buffer_pool_capacity_mb, 0);
assert_eq!(memory_config.compactor_memory_limit_mb, 819);

storage_config.data_file_cache.dir = "data".to_string();
storage_config.meta_file_cache.dir = "meta".to_string();
let memory_config =
storage_memory_config(total_non_reserved_memory_bytes, true, &storage_config);
assert_eq!(memory_config.block_cache_capacity_mb, 737);
Expand Down
Loading