Skip to content

Commit

Permalink
Merge pull request #51 from vinted/v2.39.0_for_thanos_perf_fix
Browse files Browse the repository at this point in the history
reset frameBytesLeft after writing (prometheus#11689)
  • Loading branch information
GiedriusS authored Jan 6, 2023
2 parents e895ef3 + 6765dcc commit bac8c28
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions storage/remote/codec.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,11 @@ func StreamChunkedReadResponses(
iter := series.Iterator()
lbls = MergeLabels(labelsToLabelsProto(series.Labels(), lbls), sortedExternalLabels)

frameBytesLeft := maxBytesInFrame
maxDataLength := maxBytesInFrame
for _, lbl := range lbls {
frameBytesLeft -= lbl.Size()
maxDataLength -= lbl.Size()
}
frameBytesLeft := maxDataLength

isNext := iter.Next()

Expand Down Expand Up @@ -253,6 +254,7 @@ func StreamChunkedReadResponses(
// We immediately flush the Write() so it is safe to return to the pool.
marshalPool.Put(&b)
chks = chks[:0]
frameBytesLeft = maxDataLength
}
if err := iter.Err(); err != nil {
return ss.Warnings(), err
Expand Down

0 comments on commit bac8c28

Please sign in to comment.