lib/encoding: mention unpacked block size in the error message if unparsed tail left

Updates https://github.com/VictoriaMetrics/VictoriaMetrics/issues/281
This commit is contained in:
Aliaksandr Valialkin 2019-12-24 20:34:46 +02:00
parent 9e19949c6b
commit d5c9841220
2 changed files with 4 additions and 4 deletions

View file

@ -60,10 +60,10 @@ func unmarshalInt64NearestDelta(dst []int64, src []byte, firstValue int64, items
tail, err := UnmarshalVarInt64s(is.A, src)
if err != nil {
return nil, fmt.Errorf("cannot unmarshal nearest delta: %s", err)
return nil, fmt.Errorf("cannot unmarshal nearest delta from %d bytes: %s", len(src), err)
}
if len(tail) > 0 {
return nil, fmt.Errorf("unexpected tail left after unmarshaling %d items; tail size=%d, value=%X", itemsCount, len(tail), tail)
return nil, fmt.Errorf("unexpected tail left after unmarshaling %d items from %d bytes; tail size=%d, value=%X", itemsCount, len(src), len(tail), tail)
}
v := firstValue

View file

@ -63,10 +63,10 @@ func unmarshalInt64NearestDelta2(dst []int64, src []byte, firstValue int64, item
tail, err := UnmarshalVarInt64s(is.A, src)
if err != nil {
return nil, fmt.Errorf("cannot unmarshal nearest delta: %s", err)
return nil, fmt.Errorf("cannot unmarshal nearest delta from %d bytes: %s", len(src), err)
}
if len(tail) > 0 {
return nil, fmt.Errorf("unexpected tail left after unmarshaling %d items; tail size=%d, value=%X", itemsCount, len(tail), tail)
return nil, fmt.Errorf("unexpected tail left after unmarshaling %d items from %d bytes; tail size=%d, value=%X", itemsCount, len(src), len(tail), tail)
}
v := firstValue