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 #[clap(
343 long,
344 help = "Clear the local file-backed meta cache on all compute nodes (best effort)"
345 )]
346 clear_meta_cache: bool,
347 #[clap(
348 long,
349 help = "Clear the local file-backed data cache on all compute nodes (best effort)"
350 )]
351 clear_data_cache: bool,
352 },
353 #[clap(subcommand)]
355 Refill(RefillCommands),
356}
357
358#[derive(Subcommand)]
359enum RefillCommands {
360 Stats,
362}
363
364#[derive(Subcommand)]
365enum TableCommands {
366 Scan {
368 mv_name: String,
370 data_dir: Option<String>,
372
373 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
374 use_new_object_prefix_strategy: bool,
375 },
376 ScanById {
378 table_id: TableId,
380 data_dir: Option<String>,
382 #[clap(short, long = "use-new-object-prefix-strategy", default_value = "true")]
383 use_new_object_prefix_strategy: bool,
384 },
385 List,
387}
388
389#[derive(Subcommand)]
390#[expect(clippy::large_enum_variant)]
391enum MetaCommands {
392 Pause,
394 Resume,
396 #[clap(
398 group(
399 ArgGroup::new("resume_backfill_target")
400 .required(true)
401 .args(&["job_id", "fragment_id"])
402 )
403 )]
404 ResumeBackfill {
405 #[clap(long)]
406 job_id: Option<JobId>,
407 #[clap(long)]
408 fragment_id: Option<FragmentId>,
409 },
410 ClusterInfo,
412 SourceSplitInfo {
414 #[clap(long)]
415 ignore_id: bool,
416 },
417 #[clap(verbatim_doc_comment)]
434 #[clap(group(clap::ArgGroup::new("input_group").required(true).args(&["plan", "from"])))]
435 Reschedule {
436 #[clap(long, requires = "revision")]
438 plan: Option<String>,
439 #[clap(long)]
441 revision: Option<u64>,
442 #[clap(long, conflicts_with = "revision", value_hint = clap::ValueHint::AnyPath)]
444 from: Option<String>,
445 #[clap(long, default_value = "false")]
447 dry_run: bool,
448 #[clap(long, default_value = "false")]
450 resolve_no_shuffle: bool,
451 },
452 BackupMeta {
454 #[clap(long)]
455 remarks: Option<String>,
456 },
457 RestoreMeta {
459 #[command(flatten)]
460 opts: RestoreOpts,
461 },
462 DeleteMetaSnapshots {
464 #[clap(long, value_delimiter = ',')]
465 snapshot_ids: Vec<u64>,
466 },
467
468 ListConnections,
470
471 ListServingFragmentMapping,
473
474 UnregisterWorkers {
476 #[clap(
478 long,
479 required = true,
480 value_delimiter = ',',
481 value_name = "worker_id or worker_host:worker_port, ..."
482 )]
483 workers: Vec<String>,
484
485 #[clap(short = 'y', long, default_value_t = false)]
487 yes: bool,
488
489 #[clap(long, default_value_t = false)]
491 ignore_not_found: bool,
492
493 #[clap(long, default_value_t = false)]
495 check_fragment_occupied: bool,
496 },
497
498 ValidateSource {
500 #[clap(long)]
503 props: String,
504 },
505
506 SetCdcTableBackfillParallelism {
507 #[clap(long, required = true)]
508 table_id: u32,
509 #[clap(long, required = true)]
510 parallelism: u32,
511 },
512
513 AlterSourcePropertiesSafe {
516 #[clap(long)]
518 source_id: u32,
519 #[clap(long)]
521 props: String,
522 #[clap(long, default_value_t = false)]
524 reset_splits: bool,
525 },
526
527 ResetSourceSplits {
530 #[clap(long)]
532 source_id: u32,
533 },
534
535 InjectSourceOffsets {
538 #[clap(long)]
540 source_id: u32,
541 #[clap(long)]
543 offsets: String,
544 },
545
546 CreateMetaStoreSchema {
549 #[command(flatten)]
550 opts: cmd_impl::meta::CreateMetaStoreSchemaOpts,
551 },
552}
553
554#[derive(Subcommand, Clone, Debug)]
555pub enum AwaitTreeCommands {
556 Dump {
558 #[clap(short, long = "actor-traces-format")]
560 actor_traces_format: Option<String>,
561 },
562 Analyze {
564 #[clap(long = "path")]
568 path: Option<String>,
569 },
570 Transcribe {
572 #[clap(long = "path")]
574 path: String,
575 },
576}
577
578#[derive(Subcommand, Clone, Debug)]
579enum TestCommands {
580 Jvm,
582}
583
584#[derive(Subcommand, Clone, Debug)]
585enum ThrottleCommands {
586 Source(ThrottleCommandArgs),
587 Mv(ThrottleCommandArgs),
588 Sink(ThrottleCommandArgs),
589}
590
591#[derive(Clone, Debug, clap::ValueEnum)]
592pub enum ThrottleTypeArg {
593 Dml,
594 Backfill,
595 Source,
596 Sink,
597}
598
599#[derive(Clone, Debug, Args)]
600pub struct ThrottleCommandArgs {
601 #[clap(long, required = true)]
603 id: u32,
604 #[clap(long)]
606 rate: Option<u32>,
607 #[clap(long, value_enum, required = true)]
609 throttle_type: ThrottleTypeArg,
610}
611
612#[derive(Subcommand, Clone, Debug)]
613pub enum ProfileCommands {
614 Cpu {
616 #[clap(short, long = "sleep")]
618 sleep: u64,
619 #[clap(long = "worker-type", value_name = "TYPE")]
621 worker_types: Vec<ProfileWorkerType>,
622 },
623 Heap {
625 #[clap(long = "dir")]
627 dir: Option<String>,
628 #[clap(long = "worker-type", value_name = "TYPE")]
630 worker_types: Vec<ProfileWorkerType>,
631 },
632}
633
634pub async fn start(opts: CliOpts, shutdown: CancellationToken) {
641 let context = CtlContext::default();
642
643 tokio::select! {
644 _ = shutdown.cancelled() => {
645 context.try_close().await;
647 }
648
649 result = start_fallible(opts, &context) => {
650 if let Err(e) = result {
651 eprintln!("Error: {:#?}", e.as_report()); std::process::exit(1);
653 }
654 }
655 }
656}
657
658pub async fn start_fallible(opts: CliOpts, context: &CtlContext) -> Result<()> {
661 let result = start_impl(opts, context).await;
662 context.try_close().await;
663 result
664}
665
666async fn start_impl(opts: CliOpts, context: &CtlContext) -> Result<()> {
667 match opts.command {
668 Commands::Compute(ComputeCommands::ShowConfig { host }) => {
669 cmd_impl::compute::show_config(&host).await?
670 }
671 Commands::Hummock(HummockCommands::DisableCommitEpoch) => {
672 cmd_impl::hummock::disable_commit_epoch(context).await?
673 }
674 Commands::Hummock(HummockCommands::ListVersion {
675 verbose,
676 verbose_key_range,
677 }) => {
678 cmd_impl::hummock::list_version(context, verbose, verbose_key_range).await?;
679 }
680 Commands::Hummock(HummockCommands::ListVersionDeltas {
681 start_id,
682 num_epochs,
683 }) => {
684 cmd_impl::hummock::list_version_deltas(context, start_id, num_epochs).await?;
685 }
686 Commands::Hummock(HummockCommands::ListKv {
687 epoch,
688 table_id,
689 data_dir,
690 use_new_object_prefix_strategy,
691 }) => {
692 cmd_impl::hummock::list_kv(
693 context,
694 epoch,
695 table_id,
696 data_dir,
697 use_new_object_prefix_strategy,
698 )
699 .await?;
700 }
701 Commands::Hummock(HummockCommands::SstDump(args)) => {
702 cmd_impl::hummock::sst_dump(context, args).await.unwrap()
703 }
704 Commands::Hummock(HummockCommands::TriggerManualCompaction {
705 compaction_group_id,
706 table_id,
707 levels,
708 target_level,
709 sst_ids,
710 exclusive,
711 retry_interval_ms,
712 }) => {
713 cmd_impl::hummock::trigger_manual_compaction(
714 context,
715 compaction_group_id,
716 table_id.into(),
717 levels,
718 target_level,
719 sst_ids,
720 exclusive,
721 retry_interval_ms,
722 )
723 .await?
724 }
725 Commands::Hummock(HummockCommands::TriggerFullGc {
726 sst_retention_time_sec,
727 prefix,
728 }) => cmd_impl::hummock::trigger_full_gc(context, sst_retention_time_sec, prefix).await?,
729 Commands::Hummock(HummockCommands::ListPinnedVersions {}) => {
730 list_pinned_versions(context).await?
731 }
732 Commands::Hummock(HummockCommands::ListCompactionGroup) => {
733 cmd_impl::hummock::list_compaction_group(context).await?
734 }
735 Commands::Hummock(HummockCommands::UpdateCompactionConfig {
736 compaction_group_ids,
737 max_bytes_for_level_base,
738 max_bytes_for_level_multiplier,
739 max_compaction_bytes,
740 sub_level_max_compaction_bytes,
741 level0_tier_compact_file_number,
742 target_file_size_base,
743 compaction_filter_mask,
744 max_sub_compaction,
745 level0_stop_write_threshold_sub_level_number,
746 level0_sub_level_compact_level_count,
747 max_space_reclaim_bytes,
748 level0_max_compact_file_number,
749 level0_overlapping_sub_level_compact_level_count,
750 enable_emergency_picker,
751 tombstone_reclaim_ratio,
752 compression_level,
753 compression_algorithm,
754 sstable_filter_type_level,
755 sstable_filter_type,
756 sstable_filter_layout_level,
757 sstable_filter_layout,
758 max_l0_compact_level,
759 sst_allowed_trivial_move_min_size,
760 disable_auto_group_scheduling,
761 max_overlapping_level_size,
762 sst_allowed_trivial_move_max_count,
763 emergency_level0_sst_file_count,
764 emergency_level0_sub_level_partition,
765 level0_stop_write_threshold_max_sst_count,
766 level0_stop_write_threshold_max_size,
767 enable_optimize_l0_interval_selection,
768 blocked_xor_filter_kv_count_threshold,
769 max_vnode_key_range_bytes,
770 }) => {
771 cmd_impl::hummock::update_compaction_config(
772 context,
773 compaction_group_ids,
774 build_compaction_config_vec(
775 max_bytes_for_level_base,
776 max_bytes_for_level_multiplier,
777 max_compaction_bytes,
778 sub_level_max_compaction_bytes,
779 level0_tier_compact_file_number,
780 target_file_size_base,
781 compaction_filter_mask,
782 max_sub_compaction,
783 level0_stop_write_threshold_sub_level_number,
784 level0_sub_level_compact_level_count,
785 max_space_reclaim_bytes,
786 level0_max_compact_file_number,
787 level0_overlapping_sub_level_compact_level_count,
788 enable_emergency_picker,
789 tombstone_reclaim_ratio,
790 if let Some(level) = compression_level {
791 assert!(compression_algorithm.is_some());
792 Some(CompressionAlgorithm {
793 level,
794 compression_algorithm: compression_algorithm.unwrap(),
795 })
796 } else {
797 None
798 },
799 if let (Some(level), Some(filter_type)) =
800 (sstable_filter_type_level, sstable_filter_type)
801 {
802 Some(SstableFilterType { level, filter_type })
803 } else {
804 None
805 },
806 if let (Some(level), Some(layout)) =
807 (sstable_filter_layout_level, sstable_filter_layout)
808 {
809 Some(SstableFilterLayout { level, layout })
810 } else {
811 None
812 },
813 max_l0_compact_level,
814 sst_allowed_trivial_move_min_size,
815 disable_auto_group_scheduling,
816 max_overlapping_level_size,
817 sst_allowed_trivial_move_max_count,
818 emergency_level0_sst_file_count,
819 emergency_level0_sub_level_partition,
820 level0_stop_write_threshold_max_sst_count,
821 level0_stop_write_threshold_max_size,
822 enable_optimize_l0_interval_selection,
823 blocked_xor_filter_kv_count_threshold,
824 max_vnode_key_range_bytes,
825 ),
826 )
827 .await?
828 }
829 Commands::Hummock(HummockCommands::SplitCompactionGroup {
830 compaction_group_id,
831 table_ids,
832 partition_vnode_count,
833 }) => {
834 cmd_impl::hummock::split_compaction_group(
835 context,
836 compaction_group_id,
837 &table_ids.into_iter().map_into().collect_vec(),
838 partition_vnode_count,
839 )
840 .await?;
841 }
842 Commands::Hummock(HummockCommands::PauseVersionCheckpoint) => {
843 cmd_impl::hummock::pause_version_checkpoint(context).await?;
844 }
845 Commands::Hummock(HummockCommands::ResumeVersionCheckpoint) => {
846 cmd_impl::hummock::resume_version_checkpoint(context).await?;
847 }
848 Commands::Hummock(HummockCommands::ReplayVersion) => {
849 cmd_impl::hummock::replay_version(context).await?;
850 }
851 Commands::Hummock(HummockCommands::ListCompactionStatus { verbose }) => {
852 cmd_impl::hummock::list_compaction_status(context, verbose).await?;
853 }
854 Commands::Hummock(HummockCommands::GetCompactionScore {
855 compaction_group_id,
856 }) => {
857 cmd_impl::hummock::get_compaction_score(context, compaction_group_id).await?;
858 }
859 Commands::Hummock(HummockCommands::ValidateVersion) => {
860 cmd_impl::hummock::validate_version(context).await?;
861 }
862 Commands::Hummock(HummockCommands::RebuildTableStats) => {
863 cmd_impl::hummock::rebuild_table_stats(context).await?;
864 }
865 Commands::Hummock(HummockCommands::CancelCompactTask { task_id }) => {
866 cmd_impl::hummock::cancel_compact_task(context, task_id).await?;
867 }
868 Commands::Hummock(HummockCommands::PrintVersionDeltaInArchive {
869 archive_ids,
870 data_dir,
871 sst_id,
872 use_new_object_prefix_strategy,
873 }) => {
874 cmd_impl::hummock::print_version_delta_in_archive(
875 context,
876 archive_ids.into_iter().map(HummockVersionId::new),
877 data_dir,
878 sst_id,
879 use_new_object_prefix_strategy,
880 )
881 .await?;
882 }
883 Commands::Hummock(HummockCommands::PrintUserKeyInArchive {
884 archive_ids,
885 data_dir,
886 user_key,
887 use_new_object_prefix_strategy,
888 }) => {
889 cmd_impl::hummock::print_user_key_in_archive(
890 context,
891 archive_ids.into_iter().map(HummockVersionId::new),
892 data_dir,
893 user_key,
894 use_new_object_prefix_strategy,
895 )
896 .await?;
897 }
898 Commands::Hummock(HummockCommands::TieredCacheTracing {
899 enable,
900 record_hybrid_insert_threshold_ms,
901 record_hybrid_get_threshold_ms,
902 record_hybrid_obtain_threshold_ms,
903 record_hybrid_remove_threshold_ms,
904 record_hybrid_fetch_threshold_ms,
905 }) => {
906 cmd_impl::hummock::tiered_cache_tracing(
907 context,
908 enable,
909 record_hybrid_insert_threshold_ms,
910 record_hybrid_get_threshold_ms,
911 record_hybrid_obtain_threshold_ms,
912 record_hybrid_remove_threshold_ms,
913 record_hybrid_fetch_threshold_ms,
914 )
915 .await?
916 }
917 Commands::Hummock(HummockCommands::MergeCompactionGroup {
918 left_group_id,
919 right_group_id,
920 }) => {
921 cmd_impl::hummock::merge_compaction_group(context, left_group_id, right_group_id)
922 .await?
923 }
924
925 Commands::Hummock(HummockCommands::MigrateLegacyObject {
926 url,
927 source_dir,
928 target_dir,
929 concurrency,
930 }) => {
931 migrate_legacy_object(url, source_dir, target_dir, concurrency).await?;
932 }
933 Commands::Hummock(HummockCommands::ResizeCache {
934 meta_cache_capacity_mb,
935 data_cache_capacity_mb,
936 clear_meta_cache,
937 clear_data_cache,
938 }) => {
939 const MIB: u64 = 1024 * 1024;
940 cmd_impl::hummock::resize_cache(
941 context,
942 meta_cache_capacity_mb.map(|v| v * MIB),
943 data_cache_capacity_mb.map(|v| v * MIB),
944 clear_meta_cache,
945 clear_data_cache,
946 )
947 .await?
948 }
949 Commands::Hummock(HummockCommands::Refill(RefillCommands::Stats)) => {
950 cmd_impl::hummock::refill_stats(context).await?
951 }
952 Commands::Table(TableCommands::Scan {
953 mv_name,
954 data_dir,
955 use_new_object_prefix_strategy,
956 }) => {
957 cmd_impl::table::scan(context, mv_name, data_dir, use_new_object_prefix_strategy)
958 .await?
959 }
960 Commands::Table(TableCommands::ScanById {
961 table_id,
962 data_dir,
963 use_new_object_prefix_strategy,
964 }) => {
965 cmd_impl::table::scan_id(context, table_id, data_dir, use_new_object_prefix_strategy)
966 .await?
967 }
968 Commands::Table(TableCommands::List) => cmd_impl::table::list(context).await?,
969 Commands::Bench(cmd) => cmd_impl::bench::do_bench(context, cmd).await?,
970 Commands::Meta(MetaCommands::Pause) => cmd_impl::meta::pause(context).await?,
971 Commands::Meta(MetaCommands::Resume) => cmd_impl::meta::resume(context).await?,
972 Commands::Meta(MetaCommands::ResumeBackfill {
973 job_id,
974 fragment_id,
975 }) => cmd_impl::meta::resume_backfill(context, job_id, fragment_id).await?,
976 Commands::Meta(MetaCommands::ClusterInfo) => cmd_impl::meta::cluster_info(context).await?,
977 Commands::Meta(MetaCommands::SourceSplitInfo { ignore_id }) => {
978 cmd_impl::meta::source_split_info(context, ignore_id).await?
979 }
980 Commands::Meta(MetaCommands::Reschedule {
981 from,
982 dry_run,
983 plan,
984 revision,
985 resolve_no_shuffle,
986 }) => {
987 cmd_impl::meta::reschedule(context, plan, revision, from, dry_run, resolve_no_shuffle)
988 .await?
989 }
990 Commands::Meta(MetaCommands::BackupMeta { remarks }) => {
991 cmd_impl::meta::backup_meta(context, remarks).await?
992 }
993 Commands::Meta(MetaCommands::RestoreMeta { opts }) => {
994 risingwave_meta::backup_restore::restore(opts).await?
995 }
996 Commands::Meta(MetaCommands::DeleteMetaSnapshots { snapshot_ids }) => {
997 cmd_impl::meta::delete_meta_snapshots(context, &snapshot_ids).await?
998 }
999 Commands::Meta(MetaCommands::ListConnections) => {
1000 cmd_impl::meta::list_connections(context).await?
1001 }
1002 Commands::Meta(MetaCommands::ListServingFragmentMapping) => {
1003 cmd_impl::meta::list_serving_fragment_mappings(context).await?
1004 }
1005 Commands::Meta(MetaCommands::UnregisterWorkers {
1006 workers,
1007 yes,
1008 ignore_not_found,
1009 check_fragment_occupied,
1010 }) => {
1011 cmd_impl::meta::unregister_workers(
1012 context,
1013 workers,
1014 yes,
1015 ignore_not_found,
1016 check_fragment_occupied,
1017 )
1018 .await?
1019 }
1020 Commands::Meta(MetaCommands::ValidateSource { props }) => {
1021 cmd_impl::meta::validate_source(context, props).await?
1022 }
1023 Commands::AwaitTree(AwaitTreeCommands::Dump {
1024 actor_traces_format,
1025 }) => cmd_impl::await_tree::dump(context, actor_traces_format).await?,
1026 Commands::AwaitTree(AwaitTreeCommands::Analyze { path }) => {
1027 cmd_impl::await_tree::bottleneck_detect(context, path).await?
1028 }
1029 Commands::AwaitTree(AwaitTreeCommands::Transcribe { path }) => {
1030 rw_diagnose_tools::await_tree::transcribe(path)?
1031 }
1032 Commands::Profile(ProfileCommands::Cpu {
1033 sleep,
1034 worker_types,
1035 }) => cmd_impl::profile::cpu_profile(context, sleep, worker_types).await?,
1036 Commands::Profile(ProfileCommands::Heap { dir, worker_types }) => {
1037 cmd_impl::profile::heap_profile(context, dir, worker_types).await?
1038 }
1039 Commands::Throttle(ThrottleCommands::Source(args)) => {
1040 apply_throttle(context, risingwave_pb::meta::PbThrottleTarget::Source, args).await?
1041 }
1042 Commands::Throttle(ThrottleCommands::Mv(args)) => {
1043 apply_throttle(context, risingwave_pb::meta::PbThrottleTarget::Mv, args).await?;
1044 }
1045 Commands::Throttle(ThrottleCommands::Sink(args)) => {
1046 apply_throttle(context, risingwave_pb::meta::PbThrottleTarget::Sink, args).await?;
1047 }
1048 Commands::Meta(MetaCommands::SetCdcTableBackfillParallelism {
1049 table_id,
1050 parallelism,
1051 }) => {
1052 set_cdc_table_backfill_parallelism(context, table_id, parallelism).await?;
1053 }
1054 Commands::Meta(MetaCommands::AlterSourcePropertiesSafe {
1055 source_id,
1056 props,
1057 reset_splits,
1058 }) => {
1059 cmd_impl::meta::alter_source_properties_safe(context, source_id, props, reset_splits)
1060 .await?;
1061 }
1062 Commands::Meta(MetaCommands::ResetSourceSplits { source_id }) => {
1063 cmd_impl::meta::reset_source_splits(context, source_id).await?;
1064 }
1065 Commands::Meta(MetaCommands::InjectSourceOffsets { source_id, offsets }) => {
1066 cmd_impl::meta::inject_source_offsets(context, source_id, offsets).await?;
1067 }
1068 Commands::Meta(MetaCommands::CreateMetaStoreSchema { opts }) => {
1069 cmd_impl::meta::create_meta_store_schema(opts).await?;
1070 }
1071 Commands::Test(TestCommands::Jvm) => cmd_impl::test::test_jvm()?,
1072 }
1073 Ok(())
1074}