Skip to content

Commit

Permalink
Introduce a ChunkRef type as part of logproto (#5643)
Browse files Browse the repository at this point in the history
* Change protobuf definitions

* Adapt to an embedded ChunkRef struct

* Move the Checksum to the ChunkRef
  • Loading branch information
simonswine authored Mar 17, 2022
1 parent 6a533e5 commit ea62af5
Show file tree
Hide file tree
Showing 18 changed files with 669 additions and 260 deletions.
2 changes: 1 addition & 1 deletion cmd/migrate/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ func (m *chunkMover) moveChunks(ctx context.Context, threadID int, syncRangeCh <
}
if m.sourceUser != m.destUser {
// Because the incoming chunks are already encoded, to change the username we have to make a new chunk
nc := chunk.NewChunk(m.destUser, chk.Fingerprint, chk.Metric, chk.Data, chk.From, chk.Through)
nc := chunk.NewChunk(m.destUser, chk.FingerprintModel(), chk.Metric, chk.Data, chk.From, chk.Through)
err := nc.Encode()
if err != nil {
log.Println(threadID, "Failed to encode new chunk with new user:", err)
Expand Down
99 changes: 50 additions & 49 deletions pkg/ingester/client/ingester.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pkg/ingester/client/ingester.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ syntax = "proto3";

package ingesterpb;

option go_package = "client";
option go_package = "github.com/grafana/loki/pkg/ingester/client";

import "github.com/gogo/protobuf/gogoproto/gogo.proto";
import "pkg/logproto/metrics.proto";
Expand Down
4 changes: 2 additions & 2 deletions pkg/ingester/flush_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ func TestFlushingCollidingLabels(t *testing.T) {
// make sure all chunks have different fingerprint, even colliding ones.
chunkFingerprints := map[model.Fingerprint]bool{}
for _, c := range store.getChunksForUser(userID) {
require.False(t, chunkFingerprints[c.Fingerprint])
chunkFingerprints[c.Fingerprint] = true
require.False(t, chunkFingerprints[c.FingerprintModel()])
chunkFingerprints[c.FingerprintModel()] = true
}
}

Expand Down
Loading

0 comments on commit ea62af5

Please sign in to comment.