Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix KafkaMessage::parse_record_batch #1680

Merged
merged 2 commits into from
Jan 8, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use compress_type instead of compressed
  • Loading branch information
kedixa committed Jan 8, 2025
commit b3fe8d7583cb73dddc60d036a012ac3eca5a0940
8 changes: 4 additions & 4 deletions src/protocol/KafkaMessage.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1450,11 +1450,11 @@ int KafkaMessage::parse_record_batch(void **buf, size_t *size,
return 1;

KafkaBlock block;
bool compressed = ((hdr.attributes & 7) != 0);
int compress_type = hdr.attributes & 7;

if (compressed)
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 @@ -1493,7 +1493,7 @@ int KafkaMessage::parse_record_batch(void **buf, size_t *size,
}
}

if (!compressed)
if (compress_type == 0)
{
*buf = p;
*size = n;
Expand Down
Loading