Skip to content

Commit

Permalink
chore: Use force mode with risectl unregister-workers. (#14575)
Browse files Browse the repository at this point in the history
Co-authored-by: Shanicky Chen <[email protected]>
  • Loading branch information
shanicky and Shanicky Chen authored Jan 15, 2024
1 parent 75c1076 commit f2af4e6
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ctl/src/cmd_impl/meta/reschedule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ pub async fn unregister_workers(
workers: Vec<String>,
yes: bool,
ignore_not_found: bool,
check_fragment_occupied: bool,
) -> Result<()> {
let meta_client = context.meta_client().await?;

Expand Down Expand Up @@ -320,7 +321,7 @@ pub async fn unregister_workers(
.intersection(&target_worker_ids)
.collect();

if !intersection_worker_ids.is_empty() {
if check_fragment_occupied && !intersection_worker_ids.is_empty() {
println!(
"worker ids {:?} are still occupied by fragment #{}",
intersection_worker_ids, fragment_id
Expand Down
16 changes: 15 additions & 1 deletion src/ctl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,6 +486,10 @@ enum MetaCommands {
/// The worker not found will be ignored
#[clap(long, default_value_t = false)]
ignore_not_found: bool,

/// Checking whether the fragment is occupied by workers
#[clap(long, default_value_t = false)]
check_fragment_occupied: bool,
},

/// Validate source interface for the cloud team
Expand Down Expand Up @@ -706,7 +710,17 @@ pub async fn start_impl(opts: CliOpts, context: &CtlContext) -> Result<()> {
workers,
yes,
ignore_not_found,
}) => cmd_impl::meta::unregister_workers(context, workers, yes, ignore_not_found).await?,
check_fragment_occupied,
}) => {
cmd_impl::meta::unregister_workers(
context,
workers,
yes,
ignore_not_found,
check_fragment_occupied,
)
.await?
}
Commands::Meta(MetaCommands::ValidateSource { props }) => {
cmd_impl::meta::validate_source(context, props).await?
}
Expand Down

0 comments on commit f2af4e6

Please sign in to comment.