Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug #1

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/kgo/consumer_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -1103,6 +1103,12 @@ func (g *groupConsumer) handleJoinResp(resp *kmsg.JoinGroupResponse) (restart bo
}

leader := resp.LeaderID == resp.MemberID
if *g.cfg.instanceID != "" {
leader = strings.HasPrefix(resp.LeaderID, *g.cfg.instanceID)
zywillc marked this conversation as resolved.
Show resolved Hide resolved
}

g.cfg.logger.Log(LogLevelInfo, fmt.Sprintf("leader is [%s]", resp.LeaderID))

if leader {
g.leader.set(true)
g.cfg.logger.Log(LogLevelInfo, "joined, balancing group",
Expand All @@ -1112,6 +1118,7 @@ func (g *groupConsumer) handleJoinResp(resp *kmsg.JoinGroupResponse) (restart bo
"generation", g.generation,
"balance_protocol", protocol,
"leader", true,
"leader_id", resp.LeaderID,
)
plan, err = g.balanceGroup(protocol, resp.Members, resp.SkipAssignment)
} else {
Expand All @@ -1121,6 +1128,7 @@ func (g *groupConsumer) handleJoinResp(resp *kmsg.JoinGroupResponse) (restart bo
"instance_id", g.cfg.instanceID,
"generation", g.generation,
"leader", false,
"leader_id", resp.LeaderID,
)
}
return
Expand Down Expand Up @@ -1593,6 +1601,8 @@ func (g *groupConsumer) findNewAssignments() {
g.using[topic] += change.delta
}

g.cfg.logger.Log(LogLevelDebug, fmt.Sprintf("[ZY-DEBUG] toChange: %+v", toChange))

if !g.managing {
g.managing = true
go g.manage()
Expand All @@ -1602,6 +1612,7 @@ func (g *groupConsumer) findNewAssignments() {
if numNewTopics > 0 {
g.rejoin("rejoining because there are more topics to consume, our interests have changed")
} else if g.leader.get() {
g.cfg.logger.Log(LogLevelDebug, "[ZY-DEBUG] leader find new assignments trigger rejoin")
if len(toChange) > 0 {
g.rejoin("rejoining because we are the leader and noticed some topics have new partitions")
} else if externalRejoin {
Expand Down