Skip to content

Commit

Permalink
fix KafkaMessage::parse_record_batch (#1680)
Browse files Browse the repository at this point in the history
* fix KafkaMessage::parse_record_batch

* use compress_type instead of compressed
  • Loading branch information
kedixa authored Jan 8, 2025
1 parent b9062ae commit 90e32e3
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/protocol/KafkaMessage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1450,10 +1450,11 @@ int KafkaMessage::parse_record_batch(void **buf, size_t *size,
return 1;

KafkaBlock block;
int compress_type = hdr.attributes & 7;

if (hdr.attributes & 7)
if (compress_type != 0)
{
if (uncompress_buf(*buf, hdr.length - 61 + 12, &block, hdr.attributes & 7) < 0)
if (uncompress_buf(*buf, hdr.length - 61 + 12, &block, compress_type) < 0)
return -1;

*buf = (char *)*buf + hdr.length - 61 + 12;
Expand Down Expand Up @@ -1492,7 +1493,7 @@ int KafkaMessage::parse_record_batch(void **buf, size_t *size,
}
}

if (hdr.attributes == 0)
if (compress_type == 0)
{
*buf = p;
*size = n;
Expand Down

0 comments on commit 90e32e3

Please sign in to comment.