@@ -137,6 +137,8 @@ class leader_balancer {
137
137
138
138
bool should_stop_balance () const ;
139
139
140
+ // / Config binding fields
141
+
140
142
// On/off switch: when off, leader balancer tick will run
141
143
// but do nothing
142
144
config::binding<bool > _enabled;
@@ -185,20 +187,8 @@ class leader_balancer {
185
187
186
188
config::binding<config::leaders_preference> _default_preference;
187
189
188
- struct last_known_leader {
189
- model::broker_shard shard;
190
- clock_type::time_point expires;
191
- };
192
- absl::btree_map<raft::group_id, last_known_leader> _last_leader;
190
+ // / Service dependencies
193
191
194
- leader_balancer_probe _probe;
195
- bool _need_controller_refresh{true };
196
- bool _throttled{false };
197
- absl::btree_map<raft::group_id, clock_type::time_point> _muted;
198
- cluster::notification_id_type _leader_notify_handle;
199
- std::optional<cluster::notification_id_type>
200
- _leadership_change_notify_handle;
201
- cluster::notification_id_type _maintenance_state_notify_handle;
202
192
topic_table& _topics;
203
193
partition_leaders_table& _leaders;
204
194
members_table& _members;
@@ -209,15 +199,37 @@ class leader_balancer {
209
199
ss::sharded<partition_manager>& _partition_manager;
210
200
ss::sharded<ss::abort_source>& _as;
211
201
consensus_ptr _raft0;
202
+
203
+ // / Notifications
204
+
205
+ cluster::notification_id_type _leader_notify_handle;
206
+ std::optional<cluster::notification_id_type>
207
+ _leadership_change_notify_handle;
208
+ cluster::notification_id_type _maintenance_state_notify_handle;
209
+
212
210
ss::gate _gate;
213
211
ss::timer<clock_type> _timer;
214
212
213
+ // / Internal state
214
+
215
+ struct last_known_leader {
216
+ model::broker_shard shard;
217
+ clock_type::time_point expires;
218
+ };
219
+ absl::btree_map<raft::group_id, last_known_leader> _last_leader;
220
+
221
+ bool _need_controller_refresh{true };
222
+ bool _throttled{false };
223
+ absl::btree_map<raft::group_id, clock_type::time_point> _muted;
224
+
215
225
struct in_flight_reassignment {
216
226
reassignment value;
217
227
clock_type::time_point expires;
218
228
};
219
229
absl::flat_hash_map<raft::group_id, in_flight_reassignment>
220
230
_in_flight_changes;
231
+
232
+ leader_balancer_probe _probe;
221
233
};
222
234
223
235
} // namespace cluster
0 commit comments