diff --git a/integration/grpc_server_test.go b/integration/grpc_server_test.go index 4eab7029d11..c6e3d15643c 100644 --- a/integration/grpc_server_test.go +++ b/integration/grpc_server_test.go @@ -203,7 +203,10 @@ func TestConcurrentGrpcCalls(t *testing.T) { resp, err := s.Recv() require.NoError(t, err) expected := createStreamResponse(i) + expected.MessageWithBufRef = resp.MessageWithBufRef require.Equal(t, expected.String(), resp.String()) + resp.Free() + }(i) } diff --git a/pkg/cortexpb/codec.go b/pkg/cortexpb/codec.go index d263c55897f..ee72d1871e1 100644 --- a/pkg/cortexpb/codec.go +++ b/pkg/cortexpb/codec.go @@ -19,6 +19,8 @@ func init() { type ReleasableMessage interface { RegisterBuffer(mem.Buffer) + buffers() []mem.Buffer + unref() } type GogoProtoMessage interface { @@ -130,10 +132,25 @@ type MessageWithBufRef struct { bs mem.BufferSlice } +func (m *MessageWithBufRef) unref() { + m.bs = nil +} + +func (m *MessageWithBufRef) buffers() []mem.Buffer { + return m.bs +} + func (m *MessageWithBufRef) RegisterBuffer(buffer mem.Buffer) { m.bs = append(m.bs, buffer) } +func (m *MessageWithBufRef) MergeBuffers(o any) { + if fm, ok := o.(ReleasableMessage); ok { + m.bs = append(m.bs, fm.buffers()...) + fm.unref() + } +} + func (m *MessageWithBufRef) Free() { m.bs.Free() m.bs = m.bs[:0] diff --git a/pkg/cortexpb/codec_test.go b/pkg/cortexpb/codec_test.go new file mode 100644 index 00000000000..8d50e1ac6c6 --- /dev/null +++ b/pkg/cortexpb/codec_test.go @@ -0,0 +1,39 @@ +package cortexpb + +import ( + "testing" + "unsafe" + + "github.com/stretchr/testify/require" + "google.golang.org/grpc/mem" +) + +func TestMergingBuffers(t *testing.T) { + codec := &cortexCodec{} + wr := &WriteRequest{} + + data, err := codec.Marshal(wr) + require.NoError(t, err) + + wr1 := &WriteRequest{} + wr2 := &WriteRequest{} + require.NoError(t, codec.Unmarshal(data, wr1)) + require.NoError(t, codec.Unmarshal(data, wr2)) + // should not be the same reference but should have the same value + require.False(t, isSameReference(wr1.bs, wr2.bs)) + require.NotEmpty(t, wr1.bs) + require.Equal(t, wr1.bs, wr2.bs) + finalWr := &WriteRequest{} + finalWr.MergeBuffers(wr1) + require.Empty(t, wr1.bs) + finalWr.MergeBuffers(wr2) + require.Empty(t, wr2.bs) + require.Len(t, finalWr.bs, 2) + finalWr.Free() + require.Empty(t, finalWr.bs) +} + +func isSameReference(a, b mem.BufferSlice) bool { + return len(a) > 0 && len(b) > 0 && + unsafe.Pointer(&a[0]) == unsafe.Pointer(&b[0]) +} diff --git a/pkg/distributor/query.go b/pkg/distributor/query.go index 9645a65672f..7b2ff5b3e8d 100644 --- a/pkg/distributor/query.go +++ b/pkg/distributor/query.go @@ -297,8 +297,11 @@ func (d *Distributor) queryIngesterStream(ctx context.Context, replicationSet ri defer span.Finish() hashToChunkseries := map[string]ingester_client.TimeSeriesChunk{} + resp := &ingester_client.QueryStreamResponse{} + for _, result := range results { response := result.(*ingester_client.QueryStreamResponse) + resp.MergeBuffers(response) // Parse any chunk series for _, series := range response.Chunkseries { @@ -310,9 +313,8 @@ func (d *Distributor) queryIngesterStream(ctx context.Context, replicationSet ri } } - resp := &ingester_client.QueryStreamResponse{ - Chunkseries: make([]ingester_client.TimeSeriesChunk, 0, len(hashToChunkseries)), - } + resp.Chunkseries = make([]ingester_client.TimeSeriesChunk, 0, len(hashToChunkseries)) + for _, series := range hashToChunkseries { resp.Chunkseries = append(resp.Chunkseries, series) } diff --git a/pkg/ingester/client/ingester.pb.go b/pkg/ingester/client/ingester.pb.go index cf23254f8d2..182e633a2b2 100644 --- a/pkg/ingester/client/ingester.pb.go +++ b/pkg/ingester/client/ingester.pb.go @@ -312,7 +312,8 @@ func (m *ExemplarQueryRequest) GetMatchers() []*LabelMatchers { // QueryStreamResponse contains a batch of timeseries chunks or timeseries. Only one of these series will be populated. type QueryStreamResponse struct { - Chunkseries []TimeSeriesChunk `protobuf:"bytes,1,rep,name=chunkseries,proto3" json:"chunkseries"` + Chunkseries []TimeSeriesChunk `protobuf:"bytes,1,rep,name=chunkseries,proto3" json:"chunkseries"` + github_com_cortexproject_cortex_pkg_cortexpb.MessageWithBufRef `protobuf:"bytes,1001,opt,name=Ref,proto3,embedded=Ref,customtype=github.com/cortexproject/cortex/pkg/cortexpb.MessageWithBufRef" json:"Ref"` } func (m *QueryStreamResponse) Reset() { *m = QueryStreamResponse{} } @@ -1508,94 +1509,98 @@ func init() { func init() { proto.RegisterFile("ingester.proto", fileDescriptor_60f6df4f3586b478) } var fileDescriptor_60f6df4f3586b478 = []byte{ - // 1386 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4b, 0x6f, 0x14, 0xc7, - 0x13, 0xdf, 0xf6, 0x3e, 0xd8, 0xad, 0x7d, 0xb0, 0x6e, 0x1b, 0xbc, 0x0c, 0x7f, 0xc6, 0x30, 0x88, - 0x7f, 0xac, 0x24, 0xac, 0xc1, 0x49, 0x24, 0xc8, 0x0b, 0xd9, 0x60, 0xc0, 0x80, 0x31, 0x8c, 0x0d, - 0x89, 0xa2, 0x44, 0xa3, 0xf1, 0x6e, 0x63, 0x4f, 0x98, 0x17, 0x33, 0xbd, 0x08, 0x72, 0x4a, 0x94, - 0x0f, 0x90, 0x1c, 0x73, 0xcd, 0x2d, 0xd7, 0x48, 0xf9, 0x10, 0x1c, 0x39, 0xe4, 0x80, 0x72, 0x40, - 0x61, 0xb9, 0xe4, 0x48, 0xbe, 0x41, 0x34, 0xdd, 0x3d, 0x4f, 0xcf, 0xda, 0x4b, 0x84, 0x73, 0x9b, - 0xae, 0xfa, 0x55, 0x75, 0xd5, 0xaf, 0xab, 0xbb, 0x6a, 0x17, 0x5a, 0x86, 0xbd, 0x45, 0x7c, 0x4a, - 0xbc, 0xae, 0xeb, 0x39, 0xd4, 0xc1, 0x95, 0x9e, 0xe3, 0x51, 0xf2, 0x48, 0x9a, 0xde, 0x72, 0xb6, -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x36, 0xf1, 0xfc, 0x4e, 0x31, 0xcd, 0xd3, 0x0d, 0x7d, 0x93, - 0x98, 0xab, 0x5c, 0xa9, 0x46, 0x28, 0xe5, 0x67, 0x04, 0xd3, 0xcb, 0x8f, 0x88, 0xe5, 0x9a, 0xba, - 0xf7, 0x9f, 0x84, 0x78, 0x76, 0x47, 0x88, 0x87, 0xf2, 0x42, 0xf4, 0x13, 0x31, 0x7e, 0x09, 0x53, - 0x2c, 0xb4, 0x75, 0xea, 0x11, 0xdd, 0x8a, 0x4e, 0xe4, 0x02, 0xd4, 0x7b, 0xdb, 0x03, 0xfb, 0x7e, - 0xea, 0x48, 0x66, 0x42, 0x67, 0xf1, 0x81, 0x5c, 0x0c, 0x40, 0xe2, 0x54, 0x92, 0x16, 0xd7, 0x4a, - 0xd5, 0x89, 0x76, 0x51, 0x59, 0x87, 0x43, 0x19, 0x02, 0xde, 0xc0, 0x89, 0xff, 0x8e, 0x00, 0xb3, - 0x74, 0xee, 0xea, 0xe6, 0x80, 0xf8, 0x21, 0xa9, 0xc7, 0x00, 0xcc, 0x40, 0xaa, 0xd9, 0xba, 0x45, - 0x18, 0x99, 0x35, 0xb5, 0xc6, 0x24, 0x37, 0x75, 0x8b, 0x8c, 0xe0, 0x7c, 0xe2, 0x35, 0x38, 0x2f, - 0xee, 0xc9, 0x79, 0xe9, 0x38, 0x1a, 0x83, 0x73, 0x3c, 0x0d, 0x65, 0xd3, 0xb0, 0x0c, 0xda, 0x29, - 0x33, 0x8f, 0x7c, 0xa1, 0x9c, 0x83, 0xa9, 0x54, 0x56, 0x82, 0xa9, 0x13, 0xd0, 0xe0, 0x69, 0x3d, - 0x64, 0x72, 0xc6, 0x55, 0x4d, 0xad, 0x9b, 0x31, 0x54, 0xf9, 0x14, 0x8e, 0x24, 0x2c, 0x33, 0x27, - 0x39, 0x86, 0xfd, 0x6f, 0x08, 0x26, 0x6f, 0x84, 0x44, 0xf9, 0xfb, 0x5d, 0xa4, 0x51, 0xf6, 0xc5, - 0x44, 0xf6, 0xff, 0x82, 0x46, 0xe5, 0x03, 0x51, 0x06, 0x22, 0x6a, 0x91, 0xef, 0x2c, 0xd4, 0xe3, - 0x32, 0x08, 0xd3, 0x85, 0xa8, 0x0e, 0x7c, 0xe5, 0x23, 0xe8, 0xc4, 0x66, 0x19, 0xb2, 0xf6, 0x34, - 0xc6, 0xd0, 0xbe, 0xe3, 0x13, 0x6f, 0x9d, 0xea, 0x34, 0x24, 0x4a, 0xf9, 0x6e, 0x02, 0x26, 0x13, - 0x42, 0xe1, 0xea, 0x54, 0xf8, 0x9e, 0x1b, 0x8e, 0xad, 0x79, 0x3a, 0xe5, 0x25, 0x89, 0xd4, 0x66, - 0x24, 0x55, 0x75, 0x4a, 0x82, 0xaa, 0xb5, 0x07, 0x96, 0x26, 0x2e, 0x42, 0xc0, 0x58, 0x49, 0xad, - 0xd9, 0x03, 0x8b, 0x57, 0x7f, 0x70, 0x08, 0xba, 0x6b, 0x68, 0x19, 0x4f, 0x45, 0xe6, 0xa9, 0xad, - 0xbb, 0xc6, 0x4a, 0xca, 0x59, 0x17, 0xa6, 0xbc, 0x81, 0x49, 0xb2, 0xf0, 0x12, 0x83, 0x4f, 0x06, - 0xaa, 0x34, 0xfe, 0x24, 0x34, 0xf5, 0x1e, 0x35, 0x1e, 0x92, 0x70, 0xff, 0x32, 0xdb, 0xbf, 0xc1, - 0x85, 0x22, 0x84, 0x93, 0xd0, 0x34, 0x1d, 0xbd, 0x4f, 0xfa, 0xda, 0xa6, 0xe9, 0xf4, 0xee, 0xfb, - 0x9d, 0x0a, 0x07, 0x71, 0xe1, 0x12, 0x93, 0x29, 0x5f, 0xc1, 0x54, 0x40, 0xc1, 0xca, 0xa5, 0x34, - 0x09, 0x33, 0x70, 0x60, 0xe0, 0x13, 0x4f, 0x33, 0xfa, 0xe2, 0x42, 0x56, 0x82, 0xe5, 0x4a, 0x1f, - 0x9f, 0x86, 0x52, 0x5f, 0xa7, 0x3a, 0x4b, 0xb8,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 0x76, 0x7c, 0xa7, 0x2a, 0x27, 0xb6, - 0x25, 0xa8, 0x45, 0x5d, 0x1f, 0x77, 0x72, 0x06, 0x01, 0xee, 0x6c, 0xf4, 0x88, 0xa0, 0x14, 0xf0, - 0x65, 0x68, 0x2c, 0x9a, 0xe6, 0x38, 0x6e, 0xa4, 0xa4, 0xc6, 0xcf, 0xfa, 0x31, 0xa3, 0x06, 0x92, - 0xed, 0x82, 0xf8, 0xff, 0xd1, 0x1b, 0xb1, 0xeb, 0xf4, 0x20, 0xbd, 0xb5, 0x27, 0x2e, 0xda, 0xed, - 0x1b, 0x38, 0xb6, 0x6b, 0xcf, 0x1d, 0x7b, 0xcf, 0xd3, 0x7b, 0xe0, 0x72, 0x58, 0xdf, 0x80, 0x83, - 0x99, 0x56, 0x89, 0xe5, 0x8c, 0x97, 0x4c, 0xd7, 0x96, 0x66, 0x47, 0xea, 0x43, 0xbf, 0x4b, 0x1f, - 0x3f, 0x7d, 0x21, 0x17, 0x9e, 0xbd, 0x90, 0x0b, 0xaf, 0x5e, 0xc8, 0xe8, 0xdb, 0xa1, 0x8c, 0x7e, - 0x19, 0xca, 0xe8, 0xc9, 0x50, 0x46, 0x4f, 0x87, 0x32, 0xfa, 0x73, 0x28, 0xa3, 0xbf, 0x86, 0x72, - 0xe1, 0xd5, 0x50, 0x46, 0x3f, 0xbe, 0x94, 0x0b, 0x4f, 0x5f, 0xca, 0x85, 0x67, 0x2f, 0xe5, 0xc2, - 0x17, 0x95, 0x9e, 0x69, 0x10, 0x9b, 0x6e, 0x56, 0xd8, 0xbf, 0x13, 0xef, 0xfd, 0x13, 0x00, 0x00, - 0xff, 0xff, 0xfe, 0x5e, 0xa0, 0x57, 0x08, 0x11, 0x00, 0x00, + // 1442 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x58, 0x4b, 0x73, 0x13, 0xc7, + 0x16, 0x56, 0x5b, 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xb6, 0xfb, 0x88, 0xa0, 0xa6, 0xf0, 0x55, 0x28, 0x2d, 0x58, 0xd6, 0x41, 0xdc, 0xd4, 0xa3, + 0x1a, 0x9a, 0xf4, 0x63, 0x85, 0x0f, 0x48, 0xf2, 0x15, 0xc4, 0xff, 0x0e, 0xef, 0x88, 0x3d, 0xa7, + 0x87, 0xfa, 0x7f, 0xf6, 0xc5, 0x85, 0xbb, 0x3d, 0x83, 0xe3, 0x7b, 0xbe, 0xb9, 0x07, 0xde, 0xf3, + 0xcc, 0x3e, 0xb8, 0x31, 0x55, 0x5f, 0x83, 0x43, 0x89, 0xa7, 0x12, 0x2b, 0x09, 0x2f, 0x89, 0x57, + 0xbb, 0xde, 0xd8, 0x55, 0x1f, 0xf8, 0x6d, 0x7f, 0xba, 0xf5, 0x4a, 0x49, 0xbd, 0x78, 0xa5, 0xa4, + 0xde, 0xbc, 0x52, 0xd0, 0xd7, 0x43, 0x05, 0xfd, 0x34, 0x54, 0xd0, 0xf3, 0xa1, 0x82, 0xb6, 0x86, + 0x0a, 0xfa, 0x6d, 0xa8, 0xa0, 0xdf, 0x87, 0x4a, 0xea, 0xcd, 0x50, 0x41, 0xdf, 0xbf, 0x56, 0x52, + 0x5b, 0xaf, 0x95, 0xd4, 0x8b, 0xd7, 0x4a, 0xea, 0x8b, 0x5c, 0xc7, 0x32, 0x49, 0x9f, 0xad, 0xe7, + 0xf8, 0x5f, 0x23, 0x1f, 0xfc, 0x15, 0x00, 0x00, 0xff, 0xff, 0x75, 0x58, 0xd5, 0xf6, 0x85, 0x11, + 0x00, 0x00, } func (x MatchType) String() string { @@ -1789,6 +1794,9 @@ func (this *QueryStreamResponse) Equal(that interface{}) bool { return false } } + if !this.MessageWithBufRef.Equal(that1.MessageWithBufRef) { + return false + } return true } func (this *ExemplarQueryResponse) Equal(that interface{}) bool { @@ -2516,7 +2524,7 @@ func (this *QueryStreamResponse) GoString() string { if this == nil { return "nil" } - s := make([]string, 0, 5) + s := make([]string, 0, 6) s = append(s, "&client.QueryStreamResponse{") if this.Chunkseries != nil { vs := make([]*TimeSeriesChunk, len(this.Chunkseries)) @@ -2525,6 +2533,7 @@ func (this *QueryStreamResponse) GoString() string { } s = append(s, "Chunkseries: "+fmt.Sprintf("%#v", vs)+",\n") } + s = append(s, "MessageWithBufRef: "+fmt.Sprintf("%#v", this.MessageWithBufRef)+",\n") s = append(s, "}") return strings.Join(s, "") } @@ -3683,6 +3692,18 @@ func (m *QueryStreamResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + { + size := m.MessageWithBufRef.Size() + i -= size + if _, err := m.MessageWithBufRef.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + i = encodeVarintIngester(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3e + i-- + dAtA[i] = 0xca if len(m.Chunkseries) > 0 { for iNdEx := len(m.Chunkseries) - 1; iNdEx >= 0; iNdEx-- { { @@ -4683,6 +4704,8 @@ func (m *QueryStreamResponse) Size() (n int) { n += 1 + l + sovIngester(uint64(l)) } } + l = m.MessageWithBufRef.Size() + n += 2 + l + sovIngester(uint64(l)) return n } @@ -5172,6 +5195,7 @@ func (this *QueryStreamResponse) String() string { repeatedStringForChunkseries += "}" s := strings.Join([]string{`&QueryStreamResponse{`, `Chunkseries:` + repeatedStringForChunkseries + `,`, + `MessageWithBufRef:` + fmt.Sprintf("%v", this.MessageWithBufRef) + `,`, `}`, }, "") return s @@ -6036,6 +6060,39 @@ func (m *QueryStreamResponse) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 1001: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field MessageWithBufRef", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowIngester + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthIngester + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthIngester + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.MessageWithBufRef.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipIngester(dAtA[iNdEx:]) diff --git a/pkg/ingester/client/ingester.proto b/pkg/ingester/client/ingester.proto index 38b30396734..531984b0a2b 100644 --- a/pkg/ingester/client/ingester.proto +++ b/pkg/ingester/client/ingester.proto @@ -57,6 +57,7 @@ message QueryStreamResponse { repeated TimeSeriesChunk chunkseries = 1 [(gogoproto.nullable) = false]; // Not used anymore reserved 2; + cortexpb.MessageWithBufRef Ref = 1001 [(gogoproto.embed) = true, (gogoproto.customtype) = "github.com/cortexproject/cortex/pkg/cortexpb.MessageWithBufRef", (gogoproto.nullable) = false]; } message ExemplarQueryResponse { diff --git a/pkg/ingester/ingester_test.go b/pkg/ingester/ingester_test.go index 1010a6834a5..313efd6fb32 100644 --- a/pkg/ingester/ingester_test.go +++ b/pkg/ingester/ingester_test.go @@ -3736,6 +3736,7 @@ func TestIngester_QueryStream(t *testing.T) { lastResp = resp } require.Equal(t, 1, count) + expectedResponseChunks.MessageWithBufRef = lastResp.MessageWithBufRef require.Equal(t, expectedResponseChunks, lastResp) } diff --git a/pkg/querier/distributor_queryable.go b/pkg/querier/distributor_queryable.go index 025f7e1ecf1..9cc86ae4c44 100644 --- a/pkg/querier/distributor_queryable.go +++ b/pkg/querier/distributor_queryable.go @@ -92,6 +92,8 @@ type distributorQuerier struct { queryIngestersWithin time.Duration isPartialDataEnabled partialdata.IsCfgEnabledFunc ingesterQueryMaxAttempts int + + freeBuffers func() } // Select implements storage.Querier interface. @@ -166,6 +168,8 @@ func (q *distributorQuerier) streamingSelect(ctx context.Context, sortSeries, pa return storage.ErrSeriesSet(err) } + q.freeBuffers = results.Free + serieses := make([]storage.Series, 0, len(results.Chunkseries)) for _, result := range results.Chunkseries { // Sometimes the ingester can send series that have no data. @@ -357,6 +361,10 @@ func (q *distributorQuerier) labelNamesWithMatchers(ctx context.Context, hints * } func (q *distributorQuerier) Close() error { + if q.freeBuffers != nil { + q.freeBuffers() + q.freeBuffers = nil + } return nil }