Browse Source

go fmt

pull/5132/head
chrislu 1 year ago
parent
commit
e0727071c8
  1. 2
      weed/mq/broker/broker_grpc_sub_coordinator.go
  2. 1
      weed/mq/pub_balancer/balancer.go
  3. 1
      weed/mq/sub_coordinator/consumer_group.go
  4. 3
      weed/mq/sub_coordinator/coordinator.go

2
weed/mq/broker/broker_grpc_sub_coordinator.go

@ -68,7 +68,7 @@ func (b *MessageQueueBroker) SubscriberToSubCoordinator(stream mq_pb.SeaweedMess
} }
glog.V(0).Infof("subscriber %s/%s/%s disconnected: %v", initMessage.ConsumerGroup, initMessage.ConsumerInstanceId, initMessage.Topic, err) glog.V(0).Infof("subscriber %s/%s/%s disconnected: %v", initMessage.ConsumerGroup, initMessage.ConsumerInstanceId, initMessage.Topic, err)
return err return err
case message := <- cgi.ResponseChan:
case message := <-cgi.ResponseChan:
if err := stream.Send(message); err != nil { if err := stream.Send(message); err != nil {
glog.V(0).Infof("subscriber %s/%s/%s send: %v", initMessage.ConsumerGroup, initMessage.ConsumerInstanceId, initMessage.Topic, err) glog.V(0).Infof("subscriber %s/%s/%s send: %v", initMessage.ConsumerGroup, initMessage.ConsumerInstanceId, initMessage.Topic, err)
} }

1
weed/mq/pub_balancer/balancer.go

@ -32,6 +32,7 @@ type Balancer struct {
// Collected from all brokers when they connect to the broker leader // Collected from all brokers when they connect to the broker leader
TopicToBrokers cmap.ConcurrentMap[string, *PartitionSlotToBrokerList] // key: topic name TopicToBrokers cmap.ConcurrentMap[string, *PartitionSlotToBrokerList] // key: topic name
} }
func NewBalancer() *Balancer { func NewBalancer() *Balancer {
return &Balancer{ return &Balancer{
Brokers: cmap.New[*BrokerStats](), Brokers: cmap.New[*BrokerStats](),

1
weed/mq/sub_coordinator/consumer_group.go

@ -6,6 +6,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/mq/topic" "github.com/seaweedfs/seaweedfs/weed/mq/topic"
"github.com/seaweedfs/seaweedfs/weed/pb/mq_pb" "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
) )
type ConsumerGroupInstance struct { type ConsumerGroupInstance struct {
InstanceId string InstanceId string
// the consumer group instance may not have an active partition // the consumer group instance may not have an active partition

3
weed/mq/sub_coordinator/coordinator.go

@ -6,7 +6,6 @@ import (
"github.com/seaweedfs/seaweedfs/weed/pb/mq_pb" "github.com/seaweedfs/seaweedfs/weed/pb/mq_pb"
) )
type TopicConsumerGroups struct { type TopicConsumerGroups struct {
// map a consumer group name to a consumer group // map a consumer group name to a consumer group
ConsumerGroups cmap.ConcurrentMap[string, *ConsumerGroup] ConsumerGroups cmap.ConcurrentMap[string, *ConsumerGroup]
@ -50,7 +49,7 @@ func toTopicName(topic *mq_pb.Topic) string {
return topicName return topicName
} }
func (c *Coordinator) AddSubscriber(consumerGroup, consumerGroupInstance string, topic *mq_pb.Topic) *ConsumerGroupInstance{
func (c *Coordinator) AddSubscriber(consumerGroup, consumerGroupInstance string, topic *mq_pb.Topic) *ConsumerGroupInstance {
tcg := c.GetTopicConsumerGroups(topic) tcg := c.GetTopicConsumerGroups(topic)
cg, _ := tcg.ConsumerGroups.Get(consumerGroup) cg, _ := tcg.ConsumerGroups.Get(consumerGroup)
if cg == nil { if cg == nil {

Loading…
Cancel
Save