Skip to content

Commit

Permalink
fix(auto_balancer): fix npe when remove partition from cluster (AutoM…
Browse files Browse the repository at this point in the history
…Q#1486)

Signed-off-by: Shichao Nie <niesc@automq.com>
  • Loading branch information
SCNieh authored Jun 28, 2024
1 parent c552cd7 commit 7372871
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -375,8 +375,11 @@ public void deletePartition(Uuid topicId, int partitionId) {
logger.error("Failed to find topic name for id {} when deleting partition", topicId);
return;
}
if (!partitionReplicaMap.containsKey(partitionId)) {
return;
}
int brokerId = partitionReplicaMap.remove(partitionId);
if (brokerId != -1 && brokerReplicaMap.containsKey(brokerId)) {
if (brokerReplicaMap.containsKey(brokerId)) {
brokerReplicaMap.get(brokerId).remove(new TopicPartition(topicName, partitionId));
}
} finally {
Expand Down

0 comments on commit 7372871

Please sign in to comment.