From 5b13e45fdf743b2b77ffba95c85548c7a2a2b21a Mon Sep 17 00:00:00 2001 From: zhyass Date: Wed, 1 Jan 2025 00:48:45 +0800 Subject: [PATCH] vacuum temp files after recluster --- .../service/src/interpreters/interpreter_table_recluster.rs | 6 ++++++ src/query/settings/src/settings_default.rs | 2 +- src/query/sql/src/planner/binder/ddl/table.rs | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/query/service/src/interpreters/interpreter_table_recluster.rs b/src/query/service/src/interpreters/interpreter_table_recluster.rs index 8e58d8bad911d..b1b9fc1a9b113 100644 --- a/src/query/service/src/interpreters/interpreter_table_recluster.rs +++ b/src/query/service/src/interpreters/interpreter_table_recluster.rs @@ -25,6 +25,8 @@ use databend_common_sql::plans::Recluster; use log::error; use log::warn; +use crate::interpreters::hook::vacuum_hook::hook_disk_temp_dir; +use crate::interpreters::hook::vacuum_hook::hook_vacuum_temp_files; use crate::interpreters::Interpreter; use crate::interpreters::InterpreterClusteringHistory; use crate::pipelines::executor::ExecutorSettings; @@ -185,6 +187,10 @@ impl ReclusterTableInterpreter { // make sure the lock guard is dropped before the next loop. drop(lock_guard); + // vacuum temp files. + hook_vacuum_temp_files(&self.ctx)?; + hook_disk_temp_dir(&self.ctx)?; + InterpreterClusteringHistory::write_log(&self.ctx, start, &plan.database, &plan.table)?; Ok(false) } diff --git a/src/query/settings/src/settings_default.rs b/src/query/settings/src/settings_default.rs index d199506c1b384..f51df5131d19e 100644 --- a/src/query/settings/src/settings_default.rs +++ b/src/query/settings/src/settings_default.rs @@ -1156,7 +1156,7 @@ impl DefaultSettings { desc: "Specifies the domain of range IDs in Hilbert clustering. A larger value provides finer granularity, but may incur a performance cost.", mode: SettingMode::Both, scope: SettingScope::Both, - range: Some(SettingRange::Numeric(1..=65536)), + range: Some(SettingRange::Numeric(1..=65535)), }), ("hilbert_sample_size_per_block", DefaultSettingValue { value: UserSettingValue::UInt64(1000), diff --git a/src/query/sql/src/planner/binder/ddl/table.rs b/src/query/sql/src/planner/binder/ddl/table.rs index f77d931774db3..74ca1b5d51d21 100644 --- a/src/query/sql/src/planner/binder/ddl/table.rs +++ b/src/query/sql/src/planner/binder/ddl/table.rs @@ -1161,7 +1161,7 @@ impl Binder { .map(|s| { format!( "hilbert_key(cast(ifnull(range_partition_id({table}.{s}, _keys_bound.{s}_bound), {}) as uint16))", - partitions - 1 + partitions ) }) .collect::>()