Skip to content

Commit 3519624

Browse files
authored
chore: add setting "enable_distributed_compact", default T (#12971)
* chore: add setting "enable_distributed_compact", default T * update golden file
1 parent 14819b3 commit 3519624

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

src/query/service/src/interpreters/interpreter_table_optimize.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,9 @@ impl OptimizeTableInterpreter {
151151
.compact_blocks(self.ctx.clone(), self.plan.limit)
152152
.await?;
153153

154-
let is_distributed = !self.ctx.get_cluster().is_empty();
154+
let is_distributed = (!self.ctx.get_cluster().is_empty())
155+
&& self.ctx.get_settings().get_enable_distributed_compact()?;
156+
155157
let catalog_info = catalog.info();
156158
let mut compact_pipeline = if let Some((parts, snapshot)) = res {
157159
let physical_plan = Self::build_physical_plan(

src/query/service/tests/it/storages/testdata/settings_table.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ DB.Table: 'system'.'settings', Table: settings-table_id:1, ver:0, Engine: System
1010
| 'enable_aggregating_index_scan' | '1' | '1' | 'SESSION' | 'Enable scanning aggregating index data while querying.' | 'UInt64' |
1111
| 'enable_bushy_join' | '0' | '0' | 'SESSION' | 'Enables generating a bushy join plan with the optimizer.' | 'UInt64' |
1212
| 'enable_cbo' | '1' | '1' | 'SESSION' | 'Enables cost-based optimization.' | 'UInt64' |
13+
| 'enable_distributed_compact' | '1' | '1' | 'SESSION' | 'Enable distributed execution of table compaction.' | 'UInt64' |
1314
| 'enable_distributed_copy_into' | '0' | '0' | 'SESSION' | 'Enable distributed execution of copy into.' | 'UInt64' |
1415
| 'enable_distributed_replace_into' | '0' | '0' | 'SESSION' | 'Enable distributed execution of replace into.' | 'UInt64' |
1516
| 'enable_dphyp' | '1' | '1' | 'SESSION' | 'Enables dphyp join order algorithm.' | 'UInt64' |

src/query/settings/src/settings_default.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,12 @@ impl DefaultSettings {
355355
possible_values: None,
356356
display_in_show_settings: true,
357357
}),
358+
("enable_distributed_compact", DefaultSettingValue {
359+
value: UserSettingValue::UInt64(1),
360+
desc: "Enable distributed execution of table compaction.",
361+
possible_values: None,
362+
display_in_show_settings: true,
363+
}),
358364
("enable_aggregating_index_scan", DefaultSettingValue {
359365
value: UserSettingValue::UInt64(1),
360366
desc: "Enable scanning aggregating index data while querying.",

src/query/settings/src/settings_getter_setter.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ impl Settings {
420420
Ok(self.try_get_u64("enable_distributed_replace_into")? != 0)
421421
}
422422

423+
pub fn get_enable_distributed_compact(&self) -> Result<bool> {
424+
Ok(self.try_get_u64("enable_distributed_compact")? != 0)
425+
}
426+
423427
pub fn set_enable_distributed_replace(&self, val: bool) -> Result<()> {
424428
self.try_set_u64("enable_distributed_replace_into", u64::from(val))
425429
}

0 commit comments

Comments
 (0)