Skip to content

Commit

Permalink
pkg/kgo direct consumer: do not consume topics with no partitions
Browse files Browse the repository at this point in the history
If a topic has a load error, findNewAssignments will return new
assignments for topics that have no partitions. This emits extraneous
log lines and looks like progress is being made when it isn't,
  • Loading branch information
twmb committed Jan 21, 2024
1 parent d07efd9 commit a2f5ce5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/kgo/consumer_direct.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func (d *directConsumer) findNewAssignments() map[string]map[int32]Offset {
// the topic is explicitly specified.
if useTopic {
partitions := topicPartitions.load()
if d.cfg.regex && partitions.isInternal {
if d.cfg.regex && partitions.isInternal || len(partitions.partitions) == 0 {
continue
}
toUseTopic := make(map[int32]Offset, len(partitions.partitions))
Expand Down

0 comments on commit a2f5ce5

Please sign in to comment.