Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Use force mode with risectl unregister-workers. #14575

Merged
merged 1 commit into from
Jan 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading