Question about ea7: BinSpec comments

In the BinSpec example for the log file, on Record Batch #1, The CRC value in the comment is stated as

In this case, the value is 0x24db12dd , which is 618336989 in decimal.
However, the value shown in the BinSpec is

0xb069457c (`-1335278212 `)

Is this a typo or am I misreading the comment?

codecrafters-io/binspec/blob/main/binspec-visualizer/app/data/formats/kafka-cluster-metadata.yml#L22-L25

codecrafters-io/binspec/blob/f6906842e78e621b75f688ddc94e3962e33c129f/binspec-visualizer/app/data/formats/kafka-cluster-metadata.yml#L397

The paths at the bottom are links to the BinSpec code on GitHub. The forum would not let me post URLs from GitHub

Hi @harveysanders, thanks for highlighting the issue! We’ll investigate the issue and keep you updated with any progress.

We’ve fixed the typo in this PR. Thanks again for highlighting the issue! @harveysanders

there seems to be another typo here, should the value be 1 or 0 here?

I also found a similar issue with the partition ID, might have to go through the entire binspec to ensure that there aren’t other similar errors.

Hi @andy1li, the binspec states Name Length in a Record’s Value in an unsigned variable size integer, which would mean it uses zig zag encoding right? But when I decode based on this, I get something different from the binspec, and it looks like the binspec doesn’t decode using zigzag, it just converts the single byte to decimal. For the below, I get -10 (get the varint \x11, zig zag decode, then -1 as it’s a compact string), but it should be 16 according to the binspec.

Does this mean that not every unsigned variable size integer uses zig zag?

UPDATE I have just realised zig zag encoding is for signed varints only, not unsigned. Sorry to bother you!

1 Like