add broker leader

This commit is contained in:
chrislu
2023-09-18 09:01:14 -07:00
parent 0d390ec882
commit 340aea9b34
8 changed files with 384 additions and 353 deletions

View File

@@ -7,7 +7,7 @@ import (
)
const (
MaxPartitionCount = 1024
MaxPartitionCount = 8 * 9 * 5 * 7 //2520
)
type Balancer struct {
@@ -36,6 +36,7 @@ func (bs *BrokerStats) UpdateStats(stats *mq_pb.BrokerStats) {
RangeStop: topicPartitionStats.Partition.RangeStop,
},
ConsumerCount: topicPartitionStats.ConsumerCount,
IsLeader: topicPartitionStats.IsLeader,
}
consumerCount += topicPartitionStats.ConsumerCount
key := tps.TopicPartition.String()
@@ -60,6 +61,7 @@ type TopicPartition struct {
type TopicPartitionStats struct {
TopicPartition
ConsumerCount int32
IsLeader bool
}
func NewBalancer() *Balancer {