Question about ea7: List for a single partition - Name Length encoding

Hello,
I don’t get the explanation in the binserve description of this field : there seems to be a contradiction between the sentences.
I do get 0 (hence -1) but then how am I supposed to deduce the number of bytes to read for the name ?
Thanks

Gad

Name length is a “varint” and unfortunately codecrafters have not provided any proper explaination of varints in the course or the BinSpec
The only way currently is google it and try to figure out or look at how someone else has read these values

Thanks, I thought I was fine with varint : the pointers given (here for the msb parsing and bytes concatenation and here for the zigzag encoding itself when signed) were enough so far, although I may have wrongly deduced that when unsigned, we need to skip the zigzag decoding.
Anyway, here my issue is that one sentence says we should always read -1 and the next one says we should read a proper length

Since it is a compact string the length of the string will be varint - 1


From the Kafka Docs

Ok, I get it : my bad, I read “is always length = -1” instead of “is always length -1”. I just invented the “=”, lol
Thanks for your help !

1 Like