diff --git a/tsdb/chunkenc/histogram_meta.go b/tsdb/chunkenc/histogram_meta.go index 17676ae2f..7172d002e 100644 --- a/tsdb/chunkenc/histogram_meta.go +++ b/tsdb/chunkenc/histogram_meta.go @@ -20,8 +20,8 @@ import ( ) func writeHistogramChunkLayout(b *bstream, schema int32, zeroThreshold float64, positiveSpans, negativeSpans []histogram.Span) { - putVarbitInt(b, int64(schema)) putZeroThreshold(b, zeroThreshold) + putVarbitInt(b, int64(schema)) putHistogramChunkLayoutSpans(b, positiveSpans) putHistogramChunkLayoutSpans(b, negativeSpans) } @@ -31,17 +31,17 @@ func readHistogramChunkLayout(b *bstreamReader) ( positiveSpans, negativeSpans []histogram.Span, err error, ) { + zeroThreshold, err = readZeroThreshold(b) + if err != nil { + return + } + v, err := readVarbitInt(b) if err != nil { return } schema = int32(v) - zeroThreshold, err = readZeroThreshold(b) - if err != nil { - return - } - positiveSpans, err = readHistogramChunkLayoutSpans(b) if err != nil { return