Current state: Under Discussion
Discussion thread: here
JIRA: here
Please keep the discussion on the mailing list rather than commenting on the wiki (wiki discussions get unwieldy fast).
Add a new tool action, --cancel-all, to kafka-reassign-partitions that cancels all ongoing inter-broker partition reassignment in the cluster without requiring a reassignment JSON file.
The existing --cancel action remains unchanged and continues to support:
log_dirs movement cancellationOperators often need to stop all in-flight replica reassignments quickly—for example during an incident, a bad rollout, or when the original reassignment JSON is missing or out of date.
Today, the practical workflow is:
ListPartitionReassignments for the full clusterAlterPartitionReassignments request with replicas = null for each in-flight partitionThis workflow is:
The cluster already exposes the authoritative set of in-flight reassignments. The CLI should therefore provide a single, well-defined operation for the common case of cancelling all ongoing inter-broker partition reassignments.
kafka-reassign-partitions.sh)| Action | Required Arguments | Behavior |
|---|---|---|
--cancel-all | --bootstrap-server (optional --command-config, --preserve-throttles) | Lists all ongoing partition reassignments. For each reassignment with non-empty adding/removing replica sets, issues cancellation through AlterPartitionReassignments using replicas = null. |
--cancel | unchanged | Still requires --reassignment-json-file. Continues to support scoped cancellation, intra-broker log directory movement cancellation via log_dirs, and throttle cleanup based on the provided JSON plan. |
--cancel-all becomes an additional top-level action alongside:
--execute--verify--generate--cancel--listExactly one action may be specified per invocation, consistent with existing CLI behavior.
--cancel-allThe new action performs the following steps:
AdminClient.listPartitionReassignments()addingReplicas or removingReplicas is non-emptyAdminClient.alterPartitionReassignments(... Optional.empty())This provides a cluster-wide cancellation mechanism for inter-broker reassignments.
ListPartitionReassignments when adding/removing is non-empty).--cancel-all does not cancel ongoing AlterReplicaLogDirs / log_dirs moves; operators continue to use --cancel with a JSON plan that includes log_dirs for those.--preserve-throttles is not set, clear replication throttles only for brokers/topics implied by partitions that were actually cancelled (or document cluster-wide broker throttle behavior if implementation chooses otherwise—pick one and state it in the final KIP).AlterPartitionReassignments / Describe paths; cluster-wide cancel is a high-privilege operation—call out in release notes / ops docs.Listing and scripting is duplicated logic every organization reimplements, and it fails under stress. A first-class tool action matches how operators think (“cancel everything in flight”) and aligns with APIs the controller already supports.
ReassignPartitionsCommandArgsTest: --cancel-all alone with --bootstrap-server parses; --reassignment-json-file rejected with cancel-all action; --cancel + --cancel-all rejected (single action); --preserve-throttles allowed; disallowed flags still rejected (e.g. --throttle, --reassignment-batch-size).ReassignPartitionsUnitTest (or equivalent): with MockAdminClient, start a partition reassignment, run cancelAllOngoingAssignments (or full command path), assert in-flight reassignment cleared and list state has no adding/removing for that partition.--cancel with a magic empty JSON / sentinel: Confusing and easy to misuse; a dedicated action is clearer.AlterPartitionReassignments already supports per-partition cancel.