Skip to content

Commit

Permalink
kadm: use -1 for the commit if a topic is not committed to
Browse files Browse the repository at this point in the history
Previously, if a topic had commits but some partitions in it did not,
then Lag would do the CORRECT thing and show -1 for partitions that did
not have a commit. What was NOT correct was that if an ENTIRE topic had
no commits, then Lag would show the commit as 0.
  • Loading branch information
twmb committed May 26, 2024
1 parent 18e2cc3 commit f91cf73
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions pkg/kadm/groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -1588,19 +1588,19 @@ func CalculateGroupLag(
tend := endOffsets[t.Topic]
for _, p := range t.Partitions {
var (
pcommit OffsetResponse
pend ListedOffset
perr error
ok bool
pcommit = OffsetResponse{Offset: Offset{
Topic: t.Topic,
Partition: p,
At: -1,
}}
pend ListedOffset
perr error
ok bool
)

if tcommit != nil {
if pcommit, ok = tcommit[p]; !ok {
pcommit = OffsetResponse{Offset: Offset{
Topic: t.Topic,
Partition: p,
At: -1,
}}
if actualpcommit, ok := tcommit[p]; ok {
pcommit = actualpcommit
}
}
if tend == nil {
Expand Down

0 comments on commit f91cf73

Please sign in to comment.