From ea76846bdab923b673baf21c9312f86ad0d444c8 Mon Sep 17 00:00:00 2001 From: "antoine.choimet" Date: Thu, 21 Nov 2024 10:52:20 +0100 Subject: [PATCH] fix: return error when partition leader election failed for one of the partitions --- extkafka/partition_attack_elect_new_leader.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extkafka/partition_attack_elect_new_leader.go b/extkafka/partition_attack_elect_new_leader.go index 871b3bf..2bcc565 100644 --- a/extkafka/partition_attack_elect_new_leader.go +++ b/extkafka/partition_attack_elect_new_leader.go @@ -91,7 +91,7 @@ func (f kafkaBrokerElectNewLeaderAttack) Start(ctx context.Context, state *Kafka topicSet.Add(state.Topic, partitions...) - results, err := client.ElectLeaders(ctx, kadm.ElectPreferredReplica, topicSet) + results, err := client.ElectLeaders(ctx, kadm.ElectLiveReplica, topicSet) if err != nil { return nil, fmt.Errorf("failed to elect new leader for topic %s and partitions %s: %s", state.Topic, state.Partitions, err) } @@ -100,7 +100,7 @@ func (f kafkaBrokerElectNewLeaderAttack) Start(ctx context.Context, state *Kafka for partition, result := range parts { if result.Err != nil { messages = append(messages, action_kit_api.Message{ - Level: extutil.Ptr(action_kit_api.Warn), + Level: extutil.Ptr(action_kit_api.Error), Message: fmt.Sprintf("Error while electing leader for topic '%s', partition %d, error is: %s", t, partition, result.Err.Error()), }) } else {