1#![warn(clippy::large_futures, clippy::large_stack_frames)]
16#![allow(unfulfilled_lint_expectations)]
17#![recursion_limit = "256"]
18
19use anyhow::Result;
20use clap::{ArgGroup, Args, Parser, Subcommand};
21use cmd_impl::bench::BenchCommands;
22use cmd_impl::hummock::SstDumpArgs;
23use itertools::Itertools;
24use risingwave_common::util::tokio_util::sync::CancellationToken;
25use risingwave_hummock_sdk::{HummockEpoch, HummockVersionId};
26use risingwave_meta::backup_restore::RestoreOpts;
27use risingwave_pb::hummock::rise_ctl_update_compaction_config_request::{
28 CompressionAlgorithm, SstableFilterLayout, SstableFilterType,
29};
30use risingwave_pb::id::{CompactionGroupId, FragmentId, HummockSstableId, JobId, TableId};
31use thiserror_ext::AsReport;
32
33use crate::cmd_impl::hummock::{
34 build_compaction_config_vec, list_pinned_versions, migrate_legacy_object,
35};
36use crate::cmd_impl::profile::ProfileWorkerType;
37use crate::cmd_impl::scale::set_cdc_table_backfill_parallelism;
38use crate::cmd_impl::throttle::apply_throttle;
39use crate::common::CtlContext;
40
41pub mod cmd_impl;
42pub mod common;
43
44#[derive(Parser)]
50#[clap(version, about = "The DevOps tool that provides internal access to the RisingWave cluster", long_about = None)]
51#[clap(propagate_version = true)]
52#[clap(infer_subcommands = true)]
53pub struct CliOpts {
54 #[clap(subcommand)]
55 command: Commands,
56}
57
58#[derive(Subcommand)]
59#[clap(infer_subcommands = true)]
60enum Commands {
61 #[clap(subcommand)]
63 Compute(ComputeCommands),
64 #[clap(subcommand)]
66 Hummock(HummockCommands),
67 #[clap(subcommand)]
69 Table(TableCommands),
70 #[clap(subcommand)]
72 Meta(MetaCommands),
73 #[clap(subcommand)]
75 Bench(BenchCommands),
76 #[clap(subcommand)]
78 #[clap(visible_alias("trace"))]
79 AwaitTree(AwaitTreeCommands),
80 #[clap(subcommand)]
82 Profile(ProfileCommands),
83 #[clap(subcommand)]
84 Throttle(ThrottleCommands),
85 #[clap(subcommand, hide = true)]
87 Test(TestCommands),
88}
89
90#[derive(Subcommand)]
91enum ComputeCommands {
92 ShowConfig { host: String },
94}
95
96#[expect(clippy::large_enum_variant)]
97#[derive(Subcommand)]
98enum HummockCommands {
99 ListVersion {
101 #[clap(short, long = "verbose", default_value_t = false)]
102 verbose: bool,
103
104 #[clap(long = "verbose_key_range", default_value_t = false)]
105 verbose_key_range: bool,
106 },
107
108 ListVersionDeltas {
110 #[clap(short, long = "start-version-delta-id", default_value_t = HummockVersionId::new(0))]
111 start_id: HummockVersionId,
112
113 #[clap(short, long = "num-epochs", default_value_t = 100)]
114 num_epochs: u32,
115 },
116 DisableCommitEpoch,
118 ListKv {
120 #[clap(short, long = "epoch", default_value_t = HummockEpoch::MAX)]
121 epoch: u64,
122
123 #[clap(short, long = "table-id")]
124 table_id: TableId,
125
126 data_dir: Option<String>,
128
129 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
130 use_new_object_prefix_strategy: bool,
131 },
132 SstDump(SstDumpArgs),
133 TriggerManualCompaction {
135 #[clap(short, long = "compaction-group-id", default_value_t = CompactionGroupId::new(2))]
136 compaction_group_id: CompactionGroupId,
137
138 #[clap(short, long = "table-id", default_value_t = 0)]
139 table_id: u32,
140
141 #[clap(short, long = "level", value_delimiter = ',', default_values_t = vec![1u32])]
142 levels: Vec<u32>,
143
144 #[clap(long = "target-level")]
145 target_level: Option<u32>,
146
147 #[clap(short, long = "sst-ids", value_delimiter = ',')]
148 sst_ids: Vec<HummockSstableId>,
149
150 #[clap(long = "exclusive", default_value_t = false)]
151 exclusive: bool,
152
153 #[clap(long = "retry-interval-ms", default_value_t = 1000)]
154 retry_interval_ms: u64,
155 },
156 TriggerFullGc {
159 #[clap(short, long = "sst_retention_time_sec", default_value_t = 259200)]
160 sst_retention_time_sec: u64,
161 #[clap(short, long = "prefix", required = false)]
162 prefix: Option<String>,
163 },
164 ListPinnedVersions {},
166 ListCompactionGroup,
168 UpdateCompactionConfig {
170 #[clap(long, value_delimiter = ',')]
171 compaction_group_ids: Vec<CompactionGroupId>,
172 #[clap(long)]
173 max_bytes_for_level_base: Option<u64>,
174 #[clap(long)]
175 max_bytes_for_level_multiplier: Option<u64>,
176 #[clap(long)]
177 max_compaction_bytes: Option<u64>,
178 #[clap(long)]
179 sub_level_max_compaction_bytes: Option<u64>,
180 #[clap(long)]
181 level0_tier_compact_file_number: Option<u64>,
182 #[clap(long)]
183 target_file_size_base: Option<u64>,
184 #[clap(long)]
185 compaction_filter_mask: Option<u32>,
186 #[clap(long)]
187 max_sub_compaction: Option<u32>,
188 #[clap(long)]
189 level0_stop_write_threshold_sub_level_number: Option<u64>,
190 #[clap(long)]
191 level0_sub_level_compact_level_count: Option<u32>,
192 #[clap(long)]
193 max_space_reclaim_bytes: Option<u64>,
194 #[clap(long)]
195 level0_max_compact_file_number: Option<u64>,
196 #[clap(long)]
197 level0_overlapping_sub_level_compact_level_count: Option<u32>,
198 #[clap(long)]
199 enable_emergency_picker: Option<bool>,
200 #[clap(long)]
201 tombstone_reclaim_ratio: Option<u32>,
202 #[clap(long)]
203 compression_level: Option<u32>,
204 #[clap(long)]
205 compression_algorithm: Option<String>,
206 #[clap(long, requires = "sstable_filter_type")]
208 sstable_filter_type_level: Option<u32>,
209 #[clap(long, requires = "sstable_filter_type_level")]
211 sstable_filter_type: Option<String>,
212 #[clap(long, requires = "sstable_filter_layout")]
214 sstable_filter_layout_level: Option<u32>,
215 #[clap(long, requires = "sstable_filter_layout_level")]
222 sstable_filter_layout: Option<String>,
223 #[clap(long)]
224 max_l0_compact_level: Option<u32>,
225 #[clap(long)]
226 sst_allowed_trivial_move_min_size: Option<u64>,
227 #[clap(long)]
228 disable_auto_group_scheduling: Option<bool>,
229 #[clap(long)]
230 max_overlapping_level_size: Option<u64>,
231 #[clap(long)]
232 sst_allowed_trivial_move_max_count: Option<u32>,
233 #[clap(long)]
234 emergency_level0_sst_file_count: Option<u32>,
235 #[clap(long)]
236 emergency_level0_sub_level_partition: Option<u32>,
237 #[clap(long)]
238 level0_stop_write_threshold_max_sst_count: Option<u32>,
239 #[clap(long)]
240 level0_stop_write_threshold_max_size: Option<u64>,
241 #[clap(long)]
242 enable_optimize_l0_interval_selection: Option<bool>,
243 #[clap(long)]
248 blocked_xor_filter_kv_count_threshold: Option<u64>,
249 #[clap(long)]
250 max_vnode_key_range_bytes: Option<u64>,
251 },
252 SplitCompactionGroup {
254 #[clap(long)]
255 compaction_group_id: CompactionGroupId,
256 #[clap(long, value_delimiter = ',')]
257 table_ids: Vec<TableId>,
258 #[clap(long, default_value_t = 0)]
259 partition_vnode_count: u32,
260 },
261 PauseVersionCheckpoint,
263 ResumeVersionCheckpoint,
265 ReplayVersion,
267 ListCompactionStatus {
269 #[clap(short, long = "verbose", default_value_t = false)]
270 verbose: bool,
271 },
272 GetCompactionScore {
273 #[clap(long)]
274 compaction_group_id: CompactionGroupId,
275 },
276 ValidateVersion,
278 RebuildTableStats,
280 CancelCompactTask {
281 #[clap(short, long)]
282 task_id: u64,
283 },
284 PrintUserKeyInArchive {
285 #[clap(long, value_delimiter = ',')]
287 archive_ids: Vec<u64>,
288 #[clap(long)]
290 data_dir: String,
291 #[clap(long)]
293 user_key: String,
294 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
295 use_new_object_prefix_strategy: bool,
296 },
297 PrintVersionDeltaInArchive {
298 #[clap(long, value_delimiter = ',')]
300 archive_ids: Vec<u64>,
301 #[clap(long)]
303 data_dir: String,
304 #[clap(long)]
306 sst_id: HummockSstableId,
307 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
308 use_new_object_prefix_strategy: bool,
309 },
310 TieredCacheTracing {
311 #[clap(long)]
312 enable: bool,
313 #[clap(long)]
314 record_hybrid_insert_threshold_ms: Option<u32>,
315 #[clap(long)]
316 record_hybrid_get_threshold_ms: Option<u32>,
317 #[clap(long)]
318 record_hybrid_obtain_threshold_ms: Option<u32>,
319 #[clap(long)]
320 record_hybrid_remove_threshold_ms: Option<u32>,
321 #[clap(long)]
322 record_hybrid_fetch_threshold_ms: Option<u32>,
323 },
324 MergeCompactionGroup {
325 #[clap(long)]
326 left_group_id: CompactionGroupId,
327 #[clap(long)]
328 right_group_id: CompactionGroupId,
329 },
330 MigrateLegacyObject {
331 url: String,
332 source_dir: String,
333 target_dir: String,
334 #[clap(long, default_value = "100")]
335 concurrency: u32,
336 },
337 ResizeCache {
338 #[clap(long)]
339 meta_cache_capacity_mb: Option<u64>,
340 #[clap(long)]
341 data_cache_capacity_mb: Option<u64>,
342 },
343 #[clap(subcommand)]
345 Refill(RefillCommands),
346}
347
348#[derive(Subcommand)]
349enum RefillCommands {
350 Stats,
352}
353
354#[derive(Subcommand)]
355enum TableCommands {
356 Scan {
358 mv_name: String,
360 data_dir: Option<String>,
362
363 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
364 use_new_object_prefix_strategy: bool,
365 },
366 ScanById {
368 table_id: TableId,
370 data_dir: Option<String>,
372 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
373 use_new_object_prefix_strategy: bool,
374 },
375 List,
377}
378
379#[derive(Subcommand)]
380#[expect(clippy::large_enum_variant)]
381enum MetaCommands {
382 Pause,
384 Resume,
386 #[clap(
388 group(
389 ArgGroup::new("resume_backfill_target")
390 .required(true)
391 .args(&["job_id", "fragment_id"])
392 )
393 )]
394 ResumeBackfill {
395 #[clap(long)]
396 job_id: Option<JobId>,
397 #[clap(long)]
398 fragment_id: Option<FragmentId>,
399 },
400 ClusterInfo,
402 SourceSplitInfo {
404 #[clap(long)]
405 ignore_id: bool,
406 },
407 #[clap(verbatim_doc_comment)]
424 #[clap(group(clap::ArgGroup::new("input_group").required(true).args(&["plan", "from"])))]
425 Reschedule {
426 #[clap(long, requires = "revision")]
428 plan: Option<String>,
429 #[clap(long)]
431 revision: Option<u64>,
432 #[clap(long, conflicts_with = "revision", value_hint = clap::ValueHint::AnyPath)]
434 from: Option<String>,
435 #[clap(long, default_value = "false")]
437 dry_run: bool,
438 #[clap(long, default_value = "false")]
440 resolve_no_shuffle: bool,
441 },
442 BackupMeta {
444 #[clap(long)]
445 remarks: Option<String>,
446 },
447 RestoreMeta {
449 #[command(flatten)]
450 opts: RestoreOpts,
451 },
452 DeleteMetaSnapshots {
454 #[clap(long, value_delimiter = ',')]
455 snapshot_ids: Vec<u64>,
456 },
457
458 ListConnections,
460
461 ListServingFragmentMapping,
463
464 UnregisterWorkers {
466 #[clap(
468 long,
469 required = true,
470 value_delimiter = ',',
471 value_name = "worker_id or worker_host:worker_port, ..."
472 )]
473 workers: Vec<String>,
474
475 #[clap(short = 'y', long, default_value_t = false)]
477 yes: bool,
478
479 #[clap(long, default_value_t = false)]
481 ignore_not_found: bool,
482
483 #[clap(long, default_value_t = false)]
485 check_fragment_occupied: bool,
486 },
487
488 ValidateSource {
490 #[clap(long)]
493 props: String,
494 },
495
496 SetCdcTableBackfillParallelism {
497 #[clap(long, required = true)]
498 table_id: u32,
499 #[clap(long, required = true)]
500 parallelism: u32,
501 },
502
503 AlterSourcePropertiesSafe {
506 #[clap(long)]
508 source_id: u32,
509 #[clap(long)]
511 props: String,
512 #[clap(long, default_value_t = false)]
514 reset_splits: bool,
515 },
516
517 ResetSourceSplits {
520 #[clap(long)]
522 source_id: u32,
523 },
524
525 InjectSourceOffsets {
528 #[clap(long)]
530 source_id: u32,
531 #[clap(long)]
533 offsets: String,
534 },
535
536 CreateMetaStoreSchema {
539 #[command(flatten)]
540 opts: cmd_impl::meta::CreateMetaStoreSchemaOpts,
541 },
542}
543
544#[derive(Subcommand, Clone, Debug)]
545pub enum AwaitTreeCommands {
546 Dump {
548 #[clap(short, long = "actor-traces-format")]
550 actor_traces_format: Option<String>,
551 },
552 Analyze {
554 #[clap(long = "path")]
558 path: Option<String>,
559 },
560 Transcribe {
562 #[clap(long = "path")]
564 path: String,
565 },
566}
567
568#[derive(Subcommand, Clone, Debug)]
569enum TestCommands {
570 Jvm,
572}
573
574#[derive(Subcommand, Clone, Debug)]
575enum ThrottleCommands {
576 Source(ThrottleCommandArgs),
577 Mv(ThrottleCommandArgs),
578 Sink(ThrottleCommandArgs),
579}
580
581#[derive(Clone, Debug, clap::ValueEnum)]
582pub enum ThrottleTypeArg {
583 Dml,
584 Backfill,
585 Source,
586 Sink,
587}
588
589#[derive(Clone, Debug, Args)]
590pub struct ThrottleCommandArgs {
591 #[clap(long, required = true)]
593 id: u32,
594 #[clap(long)]
596 rate: Option<u32>,
597 #[clap(long, value_enum, required = true)]
599 throttle_type: ThrottleTypeArg,
600}
601
602#[derive(Subcommand, Clone, Debug)]
603pub enum ProfileCommands {
604 Cpu {
606 #[clap(short, long = "sleep")]
608 sleep: u64,
609 #[clap(long = "worker-type", value_name = "TYPE")]
611 worker_types: Vec<ProfileWorkerType>,
612 },
613 Heap {
615 #[clap(long = "dir")]
617 dir: Option<String>,
618 #[clap(long = "worker-type", value_name = "TYPE")]
620 worker_types: Vec<ProfileWorkerType>,
621 },
622}
623
624pub async fn start(opts: CliOpts, shutdown: CancellationToken) {
631 let context = CtlContext::default();
632
633 tokio::select! {
634 _ = shutdown.cancelled() => {
635 context.try_close().await;
637 }
638
639 result = start_fallible(opts, &context) => {
640 if let Err(e) = result {
641 eprintln!("Error: {:#?}", e.as_report()); std::process::exit(1);
643 }
644 }
645 }
646}
647
648pub async fn start_fallible(opts: CliOpts, context: &CtlContext) -> Result<()> {
651 let result = start_impl(opts, context).await;
652 context.try_close().await;
653 result
654}
655
656async fn start_impl(opts: CliOpts, context: &CtlContext) -> Result<()> {
657 match opts.command {
658 Commands::Compute(ComputeCommands::ShowConfig { host }) => {
659 cmd_impl::compute::show_config(&host).await?
660 }
661 Commands::Hummock(HummockCommands::DisableCommitEpoch) => {
662 cmd_impl::hummock::disable_commit_epoch(context).await?
663 }
664 Commands::Hummock(HummockCommands::ListVersion {
665 verbose,
666 verbose_key_range,
667 }) => {
668 cmd_impl::hummock::list_version(context, verbose, verbose_key_range).await?;
669 }
670 Commands::Hummock(HummockCommands::ListVersionDeltas {
671 start_id,
672 num_epochs,
673 }) => {
674 cmd_impl::hummock::list_version_deltas(context, start_id, num_epochs).await?;
675 }
676 Commands::Hummock(HummockCommands::ListKv {
677 epoch,
678 table_id,
679 data_dir,
680 use_new_object_prefix_strategy,
681 }) => {
682 cmd_impl::hummock::list_kv(
683 context,
684 epoch,
685 table_id,
686 data_dir,
687 use_new_object_prefix_strategy,
688 )
689 .await?;
690 }
691 Commands::Hummock(HummockCommands::SstDump(args)) => {
692 cmd_impl::hummock::sst_dump(context, args).await.unwrap()
693 }
694 Commands::Hummock(HummockCommands::TriggerManualCompaction {
695 compaction_group_id,
696 table_id,
697 levels,
698 target_level,
699 sst_ids,
700 exclusive,
701 retry_interval_ms,
702 }) => {
703 cmd_impl::hummock::trigger_manual_compaction(
704 context,
705 compaction_group_id,
706 table_id.into(),
707 levels,
708 target_level,
709 sst_ids,
710 exclusive,
711 retry_interval_ms,
712 )
713 .await?
714 }
715 Commands::Hummock(HummockCommands::TriggerFullGc {
716 sst_retention_time_sec,
717 prefix,
718 }) => cmd_impl::hummock::trigger_full_gc(context, sst_retention_time_sec, prefix).await?,
719 Commands::Hummock(HummockCommands::ListPinnedVersions {}) => {
720 list_pinned_versions(context).await?
721 }
722 Commands::Hummock(HummockCommands::ListCompactionGroup) => {
723 cmd_impl::hummock::list_compaction_group(context).await?
724 }
725 Commands::Hummock(HummockCommands::UpdateCompactionConfig {
726 compaction_group_ids,
727 max_bytes_for_level_base,
728 max_bytes_for_level_multiplier,
729 max_compaction_bytes,
730 sub_level_max_compaction_bytes,
731 level0_tier_compact_file_number,
732 target_file_size_base,
733 compaction_filter_mask,
734 max_sub_compaction,
735 level0_stop_write_threshold_sub_level_number,
736 level0_sub_level_compact_level_count,
737 max_space_reclaim_bytes,
738 level0_max_compact_file_number,
739 level0_overlapping_sub_level_compact_level_count,
740 enable_emergency_picker,
741 tombstone_reclaim_ratio,
742 compression_level,
743 compression_algorithm,
744 sstable_filter_type_level,
745 sstable_filter_type,
746 sstable_filter_layout_level,
747 sstable_filter_layout,
748 max_l0_compact_level,
749 sst_allowed_trivial_move_min_size,
750 disable_auto_group_scheduling,
751 max_overlapping_level_size,
752 sst_allowed_trivial_move_max_count,
753 emergency_level0_sst_file_count,
754 emergency_level0_sub_level_partition,
755 level0_stop_write_threshold_max_sst_count,
756 level0_stop_write_threshold_max_size,
757 enable_optimize_l0_interval_selection,
758 blocked_xor_filter_kv_count_threshold,
759 max_vnode_key_range_bytes,
760 }) => {
761 cmd_impl::hummock::update_compaction_config(
762 context,
763 compaction_group_ids,
764 build_compaction_config_vec(
765 max_bytes_for_level_base,
766 max_bytes_for_level_multiplier,
767 max_compaction_bytes,
768 sub_level_max_compaction_bytes,
769 level0_tier_compact_file_number,
770 target_file_size_base,
771 compaction_filter_mask,
772 max_sub_compaction,
773 level0_stop_write_threshold_sub_level_number,
774 level0_sub_level_compact_level_count,
775 max_space_reclaim_bytes,
776 level0_max_compact_file_number,
777 level0_overlapping_sub_level_compact_level_count,
778 enable_emergency_picker,
779 tombstone_reclaim_ratio,
780 if let Some(level) = compression_level {
781 assert!(compression_algorithm.is_some());
782 Some(CompressionAlgorithm {
783 level,
784 compression_algorithm: compression_algorithm.unwrap(),
785 })
786 } else {
787 None
788 },
789 if let (Some(level), Some(filter_type)) =
790 (sstable_filter_type_level, sstable_filter_type)
791 {
792 Some(SstableFilterType { level, filter_type })
793 } else {
794 None
795 },
796 if let (Some(level), Some(layout)) =
797 (sstable_filter_layout_level, sstable_filter_layout)
798 {
799 Some(SstableFilterLayout { level, layout })
800 } else {
801 None
802 },
803 max_l0_compact_level,
804 sst_allowed_trivial_move_min_size,
805 disable_auto_group_scheduling,
806 max_overlapping_level_size,
807 sst_allowed_trivial_move_max_count,
808 emergency_level0_sst_file_count,
809 emergency_level0_sub_level_partition,
810 level0_stop_write_threshold_max_sst_count,
811 level0_stop_write_threshold_max_size,
812 enable_optimize_l0_interval_selection,
813 blocked_xor_filter_kv_count_threshold,
814 max_vnode_key_range_bytes,
815 ),
816 )
817 .await?
818 }
819 Commands::Hummock(HummockCommands::SplitCompactionGroup {
820 compaction_group_id,
821 table_ids,
822 partition_vnode_count,
823 }) => {
824 cmd_impl::hummock::split_compaction_group(
825 context,
826 compaction_group_id,
827 &table_ids.into_iter().map_into().collect_vec(),
828 partition_vnode_count,
829 )
830 .await?;
831 }
832 Commands::Hummock(HummockCommands::PauseVersionCheckpoint) => {
833 cmd_impl::hummock::pause_version_checkpoint(context).await?;
834 }
835 Commands::Hummock(HummockCommands::ResumeVersionCheckpoint) => {
836 cmd_impl::hummock::resume_version_checkpoint(context).await?;
837 }
838 Commands::Hummock(HummockCommands::ReplayVersion) => {
839 cmd_impl::hummock::replay_version(context).await?;
840 }
841 Commands::Hummock(HummockCommands::ListCompactionStatus { verbose }) => {
842 cmd_impl::hummock::list_compaction_status(context, verbose).await?;
843 }
844 Commands::Hummock(HummockCommands::GetCompactionScore {
845 compaction_group_id,
846 }) => {
847 cmd_impl::hummock::get_compaction_score(context, compaction_group_id).await?;
848 }
849 Commands::Hummock(HummockCommands::ValidateVersion) => {
850 cmd_impl::hummock::validate_version(context).await?;
851 }
852 Commands::Hummock(HummockCommands::RebuildTableStats) => {
853 cmd_impl::hummock::rebuild_table_stats(context).await?;
854 }
855 Commands::Hummock(HummockCommands::CancelCompactTask { task_id }) => {
856 cmd_impl::hummock::cancel_compact_task(context, task_id).await?;
857 }
858 Commands::Hummock(HummockCommands::PrintVersionDeltaInArchive {
859 archive_ids,
860 data_dir,
861 sst_id,
862 use_new_object_prefix_strategy,
863 }) => {
864 cmd_impl::hummock::print_version_delta_in_archive(
865 context,
866 archive_ids.into_iter().map(HummockVersionId::new),
867 data_dir,
868 sst_id,
869 use_new_object_prefix_strategy,
870 )
871 .await?;
872 }
873 Commands::Hummock(HummockCommands::PrintUserKeyInArchive {
874 archive_ids,
875 data_dir,
876 user_key,
877 use_new_object_prefix_strategy,
878 }) => {
879 cmd_impl::hummock::print_user_key_in_archive(
880 context,
881 archive_ids.into_iter().map(HummockVersionId::new),
882 data_dir,
883 user_key,
884 use_new_object_prefix_strategy,
885 )
886 .await?;
887 }
888 Commands::Hummock(HummockCommands::TieredCacheTracing {
889 enable,
890 record_hybrid_insert_threshold_ms,
891 record_hybrid_get_threshold_ms,
892 record_hybrid_obtain_threshold_ms,
893 record_hybrid_remove_threshold_ms,
894 record_hybrid_fetch_threshold_ms,
895 }) => {
896 cmd_impl::hummock::tiered_cache_tracing(
897 context,
898 enable,
899 record_hybrid_insert_threshold_ms,
900 record_hybrid_get_threshold_ms,
901 record_hybrid_obtain_threshold_ms,
902 record_hybrid_remove_threshold_ms,
903 record_hybrid_fetch_threshold_ms,
904 )
905 .await?
906 }
907 Commands::Hummock(HummockCommands::MergeCompactionGroup {
908 left_group_id,
909 right_group_id,
910 }) => {
911 cmd_impl::hummock::merge_compaction_group(context, left_group_id, right_group_id)
912 .await?
913 }
914
915 Commands::Hummock(HummockCommands::MigrateLegacyObject {
916 url,
917 source_dir,
918 target_dir,
919 concurrency,
920 }) => {
921 migrate_legacy_object(url, source_dir, target_dir, concurrency).await?;
922 }
923 Commands::Hummock(HummockCommands::ResizeCache {
924 meta_cache_capacity_mb,
925 data_cache_capacity_mb,
926 }) => {
927 const MIB: u64 = 1024 * 1024;
928 cmd_impl::hummock::resize_cache(
929 context,
930 meta_cache_capacity_mb.map(|v| v * MIB),
931 data_cache_capacity_mb.map(|v| v * MIB),
932 )
933 .await?
934 }
935 Commands::Hummock(HummockCommands::Refill(RefillCommands::Stats)) => {
936 cmd_impl::hummock::refill_stats(context).await?
937 }
938 Commands::Table(TableCommands::Scan {
939 mv_name,
940 data_dir,
941 use_new_object_prefix_strategy,
942 }) => {
943 cmd_impl::table::scan(context, mv_name, data_dir, use_new_object_prefix_strategy)
944 .await?
945 }
946 Commands::Table(TableCommands::ScanById {
947 table_id,
948 data_dir,
949 use_new_object_prefix_strategy,
950 }) => {
951 cmd_impl::table::scan_id(context, table_id, data_dir, use_new_object_prefix_strategy)
952 .await?
953 }
954 Commands::Table(TableCommands::List) => cmd_impl::table::list(context).await?,
955 Commands::Bench(cmd) => cmd_impl::bench::do_bench(context, cmd).await?,
956 Commands::Meta(MetaCommands::Pause) => cmd_impl::meta::pause(context).await?,
957 Commands::Meta(MetaCommands::Resume) => cmd_impl::meta::resume(context).await?,
958 Commands::Meta(MetaCommands::ResumeBackfill {
959 job_id,
960 fragment_id,
961 }) => cmd_impl::meta::resume_backfill(context, job_id, fragment_id).await?,
962 Commands::Meta(MetaCommands::ClusterInfo) => cmd_impl::meta::cluster_info(context).await?,
963 Commands::Meta(MetaCommands::SourceSplitInfo { ignore_id }) => {
964 cmd_impl::meta::source_split_info(context, ignore_id).await?
965 }
966 Commands::Meta(MetaCommands::Reschedule {
967 from,
968 dry_run,
969 plan,
970 revision,
971 resolve_no_shuffle,
972 }) => {
973 cmd_impl::meta::reschedule(context, plan, revision, from, dry_run, resolve_no_shuffle)
974 .await?
975 }
976 Commands::Meta(MetaCommands::BackupMeta { remarks }) => {
977 cmd_impl::meta::backup_meta(context, remarks).await?
978 }
979 Commands::Meta(MetaCommands::RestoreMeta { opts }) => {
980 risingwave_meta::backup_restore::restore(opts).await?
981 }
982 Commands::Meta(MetaCommands::DeleteMetaSnapshots { snapshot_ids }) => {
983 cmd_impl::meta::delete_meta_snapshots(context, &snapshot_ids).await?
984 }
985 Commands::Meta(MetaCommands::ListConnections) => {
986 cmd_impl::meta::list_connections(context).await?
987 }
988 Commands::Meta(MetaCommands::ListServingFragmentMapping) => {
989 cmd_impl::meta::list_serving_fragment_mappings(context).await?
990 }
991 Commands::Meta(MetaCommands::UnregisterWorkers {
992 workers,
993 yes,
994 ignore_not_found,
995 check_fragment_occupied,
996 }) => {
997 cmd_impl::meta::unregister_workers(
998 context,
999 workers,
1000 yes,
1001 ignore_not_found,
1002 check_fragment_occupied,
1003 )
1004 .await?
1005 }
1006 Commands::Meta(MetaCommands::ValidateSource { props }) => {
1007 cmd_impl::meta::validate_source(context, props).await?
1008 }
1009 Commands::AwaitTree(AwaitTreeCommands::Dump {
1010 actor_traces_format,
1011 }) => cmd_impl::await_tree::dump(context, actor_traces_format).await?,
1012 Commands::AwaitTree(AwaitTreeCommands::Analyze { path }) => {
1013 cmd_impl::await_tree::bottleneck_detect(context, path).await?
1014 }
1015 Commands::AwaitTree(AwaitTreeCommands::Transcribe { path }) => {
1016 rw_diagnose_tools::await_tree::transcribe(path)?
1017 }
1018 Commands::Profile(ProfileCommands::Cpu {
1019 sleep,
1020 worker_types,
1021 }) => cmd_impl::profile::cpu_profile(context, sleep, worker_types).await?,
1022 Commands::Profile(ProfileCommands::Heap { dir, worker_types }) => {
1023 cmd_impl::profile::heap_profile(context, dir, worker_types).await?
1024 }
1025 Commands::Throttle(ThrottleCommands::Source(args)) => {
1026 apply_throttle(context, risingwave_pb::meta::PbThrottleTarget::Source, args).await?
1027 }
1028 Commands::Throttle(ThrottleCommands::Mv(args)) => {
1029 apply_throttle(context, risingwave_pb::meta::PbThrottleTarget::Mv, args).await?;
1030 }
1031 Commands::Throttle(ThrottleCommands::Sink(args)) => {
1032 apply_throttle(context, risingwave_pb::meta::PbThrottleTarget::Sink, args).await?;
1033 }
1034 Commands::Meta(MetaCommands::SetCdcTableBackfillParallelism {
1035 table_id,
1036 parallelism,
1037 }) => {
1038 set_cdc_table_backfill_parallelism(context, table_id, parallelism).await?;
1039 }
1040 Commands::Meta(MetaCommands::AlterSourcePropertiesSafe {
1041 source_id,
1042 props,
1043 reset_splits,
1044 }) => {
1045 cmd_impl::meta::alter_source_properties_safe(context, source_id, props, reset_splits)
1046 .await?;
1047 }
1048 Commands::Meta(MetaCommands::ResetSourceSplits { source_id }) => {
1049 cmd_impl::meta::reset_source_splits(context, source_id).await?;
1050 }
1051 Commands::Meta(MetaCommands::InjectSourceOffsets { source_id, offsets }) => {
1052 cmd_impl::meta::inject_source_offsets(context, source_id, offsets).await?;
1053 }
1054 Commands::Meta(MetaCommands::CreateMetaStoreSchema { opts }) => {
1055 cmd_impl::meta::create_meta_store_schema(opts).await?;
1056 }
1057 Commands::Test(TestCommands::Jvm) => cmd_impl::test::test_jvm()?,
1058 }
1059 Ok(())
1060}