Simple Consumer message set behavior broken on 0.8 branch

Details

Type: Bug

Status:Resolved

Priority: Critical

Resolution:
Not A Problem

Affects Version/s:0.8.0

Fix Version/s:
None

Component/s:
None

Labels:

None

Description

The testZKSendWithDeadBroker() test commented out in ProducerTest actually exposes a bug with path KAFKA-240. It seems that even when the broker has some messages for a topic partition, the simple consumer doesn't return those.

I've simplified this test and attached a diff to this bug. Apply it on 0.8 branch to reproduce this.

The test creates a topic new-topic with partitions on one broker. The producer sends 2 messages to one partition on that broker. The file message set on that broker returns 2 messages, but simple consumer pulling from the same broker returns only 1 message.

Neha Narkhede
added a comment - 14/Mar/12 18:39 The test creates a topic new-topic with partitions on one broker. The producer sends 2 messages to one partition on that broker. The file message set on that broker returns 2 messages, but simple consumer pulling from the same broker returns only 1 message.

I took a glancing look at the test and I think there might be a mistake. The line that reads: "assertEquals(message, messageSet.next.message)" should actually be "assertEquals(message, messageAndOffset.message)". The former progresses the iterator a second time after the preceeding line so two messages are consumed within one iteration of the loop, wherare the latter looks at one message within the current iteration alone. I'll take a closer look when I get a chance.

Prashanth Menon
added a comment - 14/Mar/12 19:58 Hi Neha,
I took a glancing look at the test and I think there might be a mistake. The line that reads: "assertEquals(message, messageSet.next.message)" should actually be "assertEquals(message, messageAndOffset.message)". The former progresses the iterator a second time after the preceeding line so two messages are consumed within one iteration of the loop, wherare the latter looks at one message within the current iteration alone. I'll take a closer look when I get a chance.