Skip to content

Commit

Permalink
kafka-946; Kafka Hadoop Consumer fails when verifying message checksu…
Browse files Browse the repository at this point in the history
…m; patched by Sam Meder; reviewed by Jun Rao
  • Loading branch information
smeder authored and junrao committed Sep 24, 2013
1 parent 61b8b2b commit bb7b45c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Expand Up @@ -196,7 +196,7 @@ protected boolean get(KafkaETLKey key, BytesWritable value) throws IOException {
if (_messageIt != null && _messageIt.hasNext()) {
MessageAndOffset messageAndOffset = _messageIt.next();

ByteBuffer buf = messageAndOffset.message().payload();
ByteBuffer buf = messageAndOffset.message().buffer();
int origSize = buf.remaining();
byte[] bytes = new byte[origSize];
buf.get(bytes, buf.position(), origSize);
Expand Down
Expand Up @@ -16,8 +16,6 @@
*/
package kafka.etl.impl;

import java.io.IOException;
import java.nio.ByteBuffer;
import kafka.etl.KafkaETLKey;
import kafka.etl.KafkaETLUtils;
import kafka.message.Message;
Expand All @@ -29,6 +27,9 @@
import org.apache.hadoop.mapred.OutputCollector;
import org.apache.hadoop.mapred.Reporter;

import java.io.IOException;
import java.nio.ByteBuffer;

/**
* Simple implementation of KafkaETLMapper. It assumes that
* input data are text timestamp (long).
Expand Down Expand Up @@ -59,7 +60,7 @@ public void map(KafkaETLKey key, BytesWritable val,
byte[] bytes = KafkaETLUtils.getBytes(val);

//check the checksum of message
Message message = new Message(bytes);
Message message = new Message(ByteBuffer.wrap(bytes));
long checksum = key.getChecksum();
if (checksum != message.checksum())
throw new IOException ("Invalid message checksum "
Expand Down

0 comments on commit bb7b45c

Please sign in to comment.