fix KafkaMessage::parse_record_batch (#1680)

* fix KafkaMessage::parse_record_batch

* use compress_type instead of compressed
This commit is contained in:
kedixa
2025-01-08 20:40:24 +08:00
committed by GitHub
parent b9062aeeff
commit 90e32e3bc4
+4 -3
View File
@@ -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;
@@ -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;