Skip to content

Commit

Permalink
fix(blockbuilder): copy entries returned by record decoder (#15549)
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthgoli authored Dec 27, 2024
1 parent bf73014 commit 52d745f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion pkg/blockbuilder/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/grafana/loki/v3/pkg/compression"
"github.com/grafana/loki/v3/pkg/kafka"
"github.com/grafana/loki/v3/pkg/kafka/partition"
"github.com/grafana/loki/v3/pkg/logproto"
"github.com/grafana/loki/v3/pkg/storage/chunk"
"github.com/grafana/loki/v3/pkg/storage/config"
"github.com/grafana/loki/v3/pkg/storage/stores"
Expand Down Expand Up @@ -546,11 +547,15 @@ func (i *BlockBuilder) loadRecords(ctx context.Context, partitionID int32, offse
continue
}

// decorder reuses entries slice, so we need to copy it
entries := make([]logproto.Entry, len(stream.Entries))
copy(entries, stream.Entries)

converted = append(converted, AppendInput{
tenant: record.TenantID,
labels: labels,
labelsStr: stream.Labels,
entries: stream.Entries,
entries: entries,
})
}

Expand Down

0 comments on commit 52d745f

Please sign in to comment.