Skip to content

Commit

Permalink
Formatting code for bounds.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ssingudasu committed Feb 1, 2024
1 parent 35f1d40 commit 0fabb10
Showing 1 changed file with 9 additions and 16 deletions.
25 changes: 9 additions & 16 deletions pkg/messages/bounds.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,22 +174,15 @@ func GetPartitionBounds(
}, nil
}

if minOffset > firstOffset {
// if minOffset is equal to lastOffset
// We read message (firstMessage) from minOffset+1 Which can lead to invalid reads
// Hence, We will not move first offset to match min offset
if minOffset >= lastOffset {
log.Debugf(
"Not Moving first offset forward to match min offset (%d) since minOffset is equal to lastOffset",
minOffset,
)
} else {
log.Debugf(
"Moving first offset forward to match min offset (%d)",
minOffset,
)
firstOffset = minOffset
}
// if minOffset is equal to lastOffset
// We read message (firstMessage) from minOffset+1 Which can lead to invalid reads
// Hence, We will not move first offset to match min offset if minOffset >= lastOffset
if minOffset > firstOffset && minOffset < lastOffset {
log.Debugf(
"Moving first offset forward to match min offset (%d)",
minOffset,
)
firstOffset = minOffset
}

var firstMessage kafka.Message
Expand Down

0 comments on commit 0fabb10

Please sign in to comment.