Skip to content

Commit

Permalink
fix: java client accepts DEAD partitions in topology
Browse files Browse the repository at this point in the history
(cherry picked from commit eaf3cda)
  • Loading branch information
lenaschoenburg authored and github-actions[bot] committed May 23, 2022
1 parent 62bd86a commit 210dcf1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,6 @@

public enum PartitionBrokerHealth {
HEALTHY,
UNHEALTHY
UNHEALTHY,
DEAD,
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ public class PartitionInfoImpl implements PartitionInfo {
public PartitionInfoImpl(final GatewayOuterClass.Partition partition) {
partitionId = partition.getPartitionId();

if (partition.getRole() == GatewayOuterClass.Partition.PartitionBrokerRole.LEADER) {
if (partition.getRole() == Partition.PartitionBrokerRole.LEADER) {
role = PartitionBrokerRole.LEADER;
} else if (partition.getRole() == GatewayOuterClass.Partition.PartitionBrokerRole.FOLLOWER) {
} else if (partition.getRole() == Partition.PartitionBrokerRole.FOLLOWER) {
role = PartitionBrokerRole.FOLLOWER;
} else if (partition.getRole() == Partition.PartitionBrokerRole.INACTIVE) {
role = PartitionBrokerRole.INACTIVE;
Expand All @@ -43,11 +43,13 @@ public PartitionInfoImpl(final GatewayOuterClass.Partition partition) {
"Unexpected partition broker role %s, should be one of %s",
partition.getRole(), Arrays.toString(PartitionBrokerRole.values())));
}
if (partition.getHealth() == GatewayOuterClass.Partition.PartitionBrokerHealth.HEALTHY) {
this.partitionBrokerHealth = PartitionBrokerHealth.HEALTHY;
} else if (partition.getHealth()
== GatewayOuterClass.Partition.PartitionBrokerHealth.UNHEALTHY) {
this.partitionBrokerHealth = PartitionBrokerHealth.UNHEALTHY;

if (partition.getHealth() == Partition.PartitionBrokerHealth.HEALTHY) {
partitionBrokerHealth = PartitionBrokerHealth.HEALTHY;
} else if (partition.getHealth() == Partition.PartitionBrokerHealth.UNHEALTHY) {
partitionBrokerHealth = PartitionBrokerHealth.UNHEALTHY;
} else if (partition.getHealth() == Partition.PartitionBrokerHealth.DEAD) {
partitionBrokerHealth = PartitionBrokerHealth.DEAD;
} else {
throw new RuntimeException(
String.format(
Expand Down

0 comments on commit 210dcf1

Please sign in to comment.