Skip to content

Commit d60ee36

Browse files
authored
fix: don't error on static assignment if rebalancing should take place (#29)
* fix: don't error on static assignment if rebalancing should take place * update evaluate tests * more logging * handle static errors in frequecy.go instead of evaluate.go * Revert "update evaluate tests" This reverts commit 3c081f1. * Revert "more logging" This reverts commit 4020cb9.
1 parent d25a0ae commit d60ee36

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

pkg/apply/rebalancers/frequency.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/segmentio/topicctl/pkg/apply/assigners"
99
"github.com/segmentio/topicctl/pkg/apply/pickers"
1010
"github.com/segmentio/topicctl/pkg/config"
11+
log "github.com/sirupsen/logrus"
1112
)
1213

1314
// FrequencyRebalancer is a Rebalancer that rebalances to achieve in-topic balance among
@@ -67,7 +68,13 @@ func (f *FrequencyRebalancer) Rebalance(
6768
if err != nil {
6869
return nil, err
6970
} else if !ok {
70-
return nil, fmt.Errorf("starting assignments on topic %s do not satisfy placement config - assignments: %#v", topic, curr)
71+
// If we're doing a static rebalance, we don't expect the existing assignments to
72+
// satify the placement config
73+
if f.placementConfig.Strategy == config.PlacementStrategyStatic {
74+
log.Info("Current partition assignment does not match static assignment, rebalancing will take place")
75+
} else {
76+
return nil, fmt.Errorf("starting assignments on topic %s do not satisfy placement config - assignments: %#v", topic, curr)
77+
}
7178
}
7279

7380
desired := admin.CopyAssignments(curr)

0 commit comments

Comments
 (0)