Skip to content

Commit

Permalink
fix(blockbuilder): copy entries returned by record decoder (grafana#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
ashwanthgoli authored and mveitas committed Jan 6, 2025
1 parent 99fe867 commit c85ce9c
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 c85ce9c

Please sign in to comment.