Skip to content

Commit

Permalink
Add error handling to ScaleController when reducing actors, replacing…
Browse files Browse the repository at this point in the history
… `assert!` with `bail!` for robustness.

Signed-off-by: Shanicky Chen <peng@risingwave-labs.com>
  • Loading branch information
shanicky committed Sep 18, 2024
1 parent a3c6e48 commit 25c8a04
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/meta/src/stream/scale.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1587,7 +1587,9 @@ impl ScaleController {

for (worker_id, n) in decreased_actor_count {
if let Some(actor_ids) = worker_to_actors.get(worker_id) {
assert!(actor_ids.len() >= n);
if actor_ids.len() < n {
bail!("plan illegal, for fragment {}, worker {} only has {} actors, but needs to reduce {}",fragment_id, worker_id, actor_ids.len(), n);
}

let removed_actors: Vec<_> = actor_ids
.iter()
Expand Down

0 comments on commit 25c8a04

Please sign in to comment.