@@ -957,6 +957,8 @@ auto partition_balancer_planner::request_context::do_with_partition(
957957 Visitor& visitor) {
958958 const bool is_disabled = _parent._state .topics ().is_disabled (ntp);
959959 const auto & orig_replicas = assignment.replicas ;
960+
961+ // check if there is an in progress move
960962 auto in_progress_it = _parent._state .topics ().updates_in_progress ().find (
961963 ntp);
962964 if (in_progress_it != _parent._state .topics ().updates_in_progress ().end ()) {
@@ -976,28 +978,39 @@ auto partition_balancer_planner::request_context::do_with_partition(
976978 }
977979
978980 if (state == reconfiguration_state::in_progress) {
979- if (can_add_cancellation ()) {
980- partition part{
981- moving_partition{ntp, replicas, orig_replicas, *this }};
982- return visitor (part);
983- } else {
981+ // partition is dead in the water, it lost quorum in the middle of
982+ // moving
983+ if (!has_quorum (all_unavailable_nodes, orig_replicas)) {
984984 partition part{immutable_partition{
985985 ntp,
986- replicas ,
987- immutable_partition::immutability_reason::batch_full ,
986+ orig_replicas ,
987+ immutable_partition::immutability_reason::no_quorum ,
988988 state,
989989 *this }};
990990 return visitor (part);
991991 }
992- } else {
992+ // if theres enough reconfiguration badwidth to process a cancel
993+ if (can_add_cancellation ()) {
994+ partition part{
995+ moving_partition{ntp, replicas, orig_replicas, *this }};
996+ return visitor (part);
997+ }
998+ // otherwise its immutable for now
993999 partition part{immutable_partition{
9941000 ntp,
9951001 replicas,
996- immutable_partition::immutability_reason::reconfiguration_state ,
1002+ immutable_partition::immutability_reason::batch_full ,
9971003 state,
9981004 *this }};
9991005 return visitor (part);
10001006 }
1007+ partition part{immutable_partition{
1008+ ntp,
1009+ replicas,
1010+ immutable_partition::immutability_reason::reconfiguration_state,
1011+ state,
1012+ *this }};
1013+ return visitor (part);
10011014 }
10021015
10031016 if (is_disabled) {
0 commit comments