...
We would like to provide a well-supported AdminClient API that does not suffer from these problems. Namely, it should support incremental replica reassignments and cancellation (revert) of ongoing reassignments.
This API can be used as a foundation on which to build future improvements.
...
We propose supporting the "cancellation" of an on-going partition rebalance. Cancellation is not the same as a revert. It is essentially a rollback of a reassignment.
To concretize the notion - a cancellation of a rebalance reassignment means stopping stopping any on-going partition movements . A partition reassignment which is half done will not have the new replicas that have entered the ISR be reverted, it will only stop the in-flight movements for replicas that are not in ISR. Note that it is possible to have a partition's replication factor become higher than configured if a reassignment is stopped half-way. We do not propose a clear way to guard against this nor revert it – users are expected to run another reassignmentand restoring the replica set to the one it was prior to the reassignment being initiated.
kafka-reassign-partitions.sh
...