Skip to content

Commit

Permalink
source: only bump session epoch if session id is non-zero
Browse files Browse the repository at this point in the history
Otherwise, we inadvertently bump epochs for killed sessions, which
results in the epoch quickly becoming invalid.
  • Loading branch information
twmb committed Jan 29, 2021
1 parent a448e82 commit c7caea1
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion pkg/kgo/source.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,9 @@ func (s *source) fetch(consumerSession *consumerSession) (fetched bool) {
return
}

s.session.bumpEpoch(resp.SessionID)
if resp.SessionID > 0 {
s.session.bumpEpoch(resp.SessionID)
}

// If we moved any partitions to preferred replicas, we reset the
// session. We do this after bumping the epoch just to ensure that we
Expand Down

0 comments on commit c7caea1

Please sign in to comment.