From 1e53b1a157792e306395cf9c2aed623a75fd09de Mon Sep 17 00:00:00 2001 From: jeremyhi Date: Mon, 8 Jun 2026 07:01:48 -0700 Subject: [PATCH] fix(config): align scan memory limit default with code (#8228) * fix(config): align scan memory limit default with code Signed-off-by: jeremyhi * fix: by AI comments Signed-off-by: jeremyhi --------- Signed-off-by: jeremyhi --- config/config.md | 4 ++-- config/datanode.example.toml | 4 ++-- config/standalone.example.toml | 4 ++-- src/cmd/tests/load_config_test.rs | 4 ++-- src/mito2/src/config.rs | 5 +++-- 5 files changed, 11 insertions(+), 10 deletions(-) diff --git a/config/config.md b/config/config.md index 6006a34eec..310cd3c2d8 100644 --- a/config/config.md +++ b/config/config.md @@ -169,7 +169,7 @@ | `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. | | `region_engine.mito.max_concurrent_scan_files` | Integer | `384` | Maximum number of SST files to scan concurrently. | | `region_engine.mito.allow_stale_entries` | Bool | `false` | Whether to allow stale WAL entries read during replay. | -| `region_engine.mito.scan_memory_limit` | String | `50%` | Memory limit for table scans across all queries.
Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").
Setting it to 0 disables the limit. | +| `region_engine.mito.scan_memory_limit` | String | `unlimited` | Memory limit for table scans across all queries.
Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").
Setting it to 0 or "unlimited" disables the limit. | | `region_engine.mito.scan_memory_on_exhausted` | String | `fail` | Controls what happens when a scan cannot get memory immediately.
"fail" (default) fails fast and is the recommended option for most users.
"wait" / "wait()" waits for memory to become available. This is mainly
for advanced tuning in bursty workloads where temporary contention is common and
higher latency is acceptable.
"wait" means "wait(10s)", not unlimited waiting. | | `region_engine.mito.min_compaction_interval` | String | `0m` | Minimum time interval between two compactions.
To align with the old behavior, the default value is 0 (no restrictions). | | `region_engine.mito.default_flat_format` | Bool | `true` | Whether to enable flat format as the default SST format. | @@ -561,7 +561,7 @@ | `region_engine.mito.sst_write_buffer_size` | String | `8MB` | Buffer size for SST writing. | | `region_engine.mito.max_concurrent_scan_files` | Integer | `384` | Maximum number of SST files to scan concurrently. | | `region_engine.mito.allow_stale_entries` | Bool | `false` | Whether to allow stale WAL entries read during replay. | -| `region_engine.mito.scan_memory_limit` | String | `50%` | Memory limit for table scans across all queries.
Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").
Setting it to 0 disables the limit. | +| `region_engine.mito.scan_memory_limit` | String | `unlimited` | Memory limit for table scans across all queries.
Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%").
Setting it to 0 or "unlimited" disables the limit. | | `region_engine.mito.scan_memory_on_exhausted` | String | `fail` | Controls what happens when a scan cannot get memory immediately.
"fail" (default) fails fast and is the recommended option for most users.
"wait" / "wait()" waits for memory to become available. This is mainly
for advanced tuning in bursty workloads where temporary contention is common and
higher latency is acceptable.
"wait" means "wait(10s)", not unlimited waiting. | | `region_engine.mito.min_compaction_interval` | String | `0m` | Minimum time interval between two compactions.
To align with the old behavior, the default value is 0 (no restrictions). | | `region_engine.mito.default_flat_format` | Bool | `true` | Whether to enable flat format as the default SST format. | diff --git a/config/datanode.example.toml b/config/datanode.example.toml index 9351c4e85d..cad0086169 100644 --- a/config/datanode.example.toml +++ b/config/datanode.example.toml @@ -535,8 +535,8 @@ allow_stale_entries = false ## Memory limit for table scans across all queries. ## Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%"). -## Setting it to 0 disables the limit. -scan_memory_limit = "50%" +## Setting it to 0 or "unlimited" disables the limit. +scan_memory_limit = "unlimited" ## Controls what happens when a scan cannot get memory immediately. ## "fail" (default) fails fast and is the recommended option for most users. ## "wait" / "wait()" waits for memory to become available. This is mainly diff --git a/config/standalone.example.toml b/config/standalone.example.toml index 5740e0e1cf..0b832d858b 100644 --- a/config/standalone.example.toml +++ b/config/standalone.example.toml @@ -655,8 +655,8 @@ allow_stale_entries = false ## Memory limit for table scans across all queries. ## Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "20%"). -## Setting it to 0 disables the limit. -scan_memory_limit = "50%" +## Setting it to 0 or "unlimited" disables the limit. +scan_memory_limit = "unlimited" ## Controls what happens when a scan cannot get memory immediately. ## "fail" (default) fails fast and is the recommended option for most users. ## "wait" / "wait()" waits for memory to become available. This is mainly diff --git a/src/cmd/tests/load_config_test.rs b/src/cmd/tests/load_config_test.rs index a8efec6244..52e8cc278c 100644 --- a/src/cmd/tests/load_config_test.rs +++ b/src/cmd/tests/load_config_test.rs @@ -73,7 +73,7 @@ fn test_load_datanode_example_config() { RegionEngineConfig::Mito(MitoConfig { auto_flush_interval: Duration::from_secs(3600), write_cache_ttl: Some(Duration::from_secs(60 * 60 * 8)), - scan_memory_limit: MemoryLimit::Percentage(50), + scan_memory_limit: MemoryLimit::Unlimited, ..Default::default() }), RegionEngineConfig::File(FileEngineConfig {}), @@ -278,7 +278,7 @@ fn test_load_standalone_example_config() { RegionEngineConfig::Mito(MitoConfig { auto_flush_interval: Duration::from_secs(3600), write_cache_ttl: Some(Duration::from_secs(60 * 60 * 8)), - scan_memory_limit: MemoryLimit::Percentage(50), + scan_memory_limit: MemoryLimit::Unlimited, ..Default::default() }), RegionEngineConfig::File(FileEngineConfig {}), diff --git a/src/mito2/src/config.rs b/src/mito2/src/config.rs index 3a85ff1c65..ac5243b56a 100644 --- a/src/mito2/src/config.rs +++ b/src/mito2/src/config.rs @@ -147,8 +147,9 @@ pub struct MitoConfig { pub max_concurrent_scan_files: usize, /// Whether to allow stale entries read during replay. pub allow_stale_entries: bool, - /// Memory limit for table scans across all queries. Setting it to 0 disables the limit. - /// Supports absolute size (e.g., "2GB") or percentage (e.g., "50%"). + /// Memory limit for table scans across all queries. + /// Setting it to 0 or "unlimited" disables the limit. + /// Supports absolute size (e.g., "2GB") or percentage of system memory (e.g., "50%"). pub scan_memory_limit: MemoryLimit, /// Behavior when scan memory tracking cannot acquire memory from the budget. /// `wait` means `wait(10s)`, not unlimited waiting.