Skip to content

Commit

Permalink
fix SpillConfig::default
Browse files Browse the repository at this point in the history
  • Loading branch information
forsaken628 committed Dec 25, 2024
1 parent b8ee29b commit c8d3b3f
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
3 changes: 3 additions & 0 deletions scripts/ci/deploy/config/databend-query-node-1.toml
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,6 @@ data_cache_storage = "none"
path = "./.databend/_cache"
# max bytes of cached data 20G
max_bytes = 21474836480

[spill]
spill_local_disk_path = "./.databend/temp/_query_spill"
16 changes: 14 additions & 2 deletions src/query/config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2920,7 +2920,7 @@ impl Default for DiskCacheKeyReloadPolicy {
}
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Args, Default)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Args)]
#[serde(default, deny_unknown_fields)]
pub struct DiskCacheConfig {
/// Max bytes of cached raw table data. Default 20GB, set it to 0 to disable it.
Expand Down Expand Up @@ -2952,7 +2952,13 @@ pub struct DiskCacheConfig {
pub sync_data: bool,
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Args, Default)]
impl Default for DiskCacheConfig {
fn default() -> Self {
inner::DiskCacheConfig::default().into()
}
}

#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize, Args)]
#[serde(default, deny_unknown_fields)]
pub struct SpillConfig {
/// Path of spill to local disk. disable if it's empty.
Expand All @@ -2968,6 +2974,12 @@ pub struct SpillConfig {
pub spill_local_disk_max_bytes: u64,
}

impl Default for SpillConfig {
fn default() -> Self {
inner::SpillConfig::default().into()
}
}

mod cache_config_converters {
use std::path::PathBuf;

Expand Down
2 changes: 1 addition & 1 deletion src/query/service/tests/it/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,6 @@ fn test_spill_config() -> Result<()> {
r#"
[spill]
spill_local_disk_path = "/data/spill"
spill_local_disk_reserved_space_percentage = 0.5
"#
.as_bytes(),
)?;
Expand All @@ -949,6 +948,7 @@ spill_local_disk_reserved_space_percentage = 0.5
let cfg = InnerConfig::load_for_test().expect("config load failed");

assert_eq!(cfg.spill.path, "/data/spill");
assert_eq!(cfg.spill.reserved_disk_ratio, 0.3);
},
);

Expand Down

0 comments on commit c8d3b3f

Please sign in to comment.