From 4be4ab385cd7d089a01795102a819df88d5557b0 Mon Sep 17 00:00:00 2001 From: wanjunlei Date: Thu, 19 Jan 2023 10:53:07 +0800 Subject: [PATCH] fix bug Signed-off-by: wanjunlei --- pkg/block/indexheader/binary_reader.go | 6 +++--- test/e2e/store_gateway_test.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pkg/block/indexheader/binary_reader.go b/pkg/block/indexheader/binary_reader.go index 60854f1e9d..0c7d062c9c 100644 --- a/pkg/block/indexheader/binary_reader.go +++ b/pkg/block/indexheader/binary_reader.go @@ -694,7 +694,7 @@ func (r *BinaryReader) init() (err error) { if lastName != nil { // Always include last value for each label name, unless it was just added in previous iteration based // on valueCount. - if (valueCount-1)%postingOffsetsInMemSampling != 0 { + if (valueCount-1)%r.postingOffsetsInMemSampling != 0 { r.postings[string(lastName)].offsets = append(r.postings[string(lastName)].offsets, postingOffset{value: string(lastValue), tableOff: lastTableOff}) } r.postings[string(lastName)].lastValOffset = int64(postingsOffset - crc32.Size) @@ -709,7 +709,7 @@ func (r *BinaryReader) init() (err error) { lastTableOff = labelOffset valueCount++ - if (valueCount-1)%postingOffsetsInMemSampling == 0 { + if (valueCount-1)%r.postingOffsetsInMemSampling == 0 { r.postings[string(name)].offsets = append(r.postings[string(name)].offsets, postingOffset{value: string(value), tableOff: labelOffset}) } @@ -718,7 +718,7 @@ func (r *BinaryReader) init() (err error) { return errors.Wrap(err, "read postings table") } if lastName != nil { - if (valueCount-1)%postingOffsetsInMemSampling != 0 { + if (valueCount-1)%r.postingOffsetsInMemSampling != 0 { // Always include last value for each label name if not included already based on valueCount. r.postings[string(lastName)].offsets = append(r.postings[string(lastName)].offsets, postingOffset{value: string(lastValue), tableOff: lastTableOff}) } diff --git a/test/e2e/store_gateway_test.go b/test/e2e/store_gateway_test.go index 5bfc0c50bc..0b16f58bbd 100644 --- a/test/e2e/store_gateway_test.go +++ b/test/e2e/store_gateway_test.go @@ -288,7 +288,7 @@ func TestStoreGatewayNoCacheFile(t *testing.T) { t.Cleanup(e2ethanos.CleanScenario(t, e)) const bucket = "store-no-cache-test" - m := e2ethanos.NewMinio(e, "thanos-minio", bucket) + m := e2edb.NewMinio(e, "thanos-minio", bucket, e2edb.WithMinioTLS()) testutil.Ok(t, e2e.StartAndWaitReady(m)) s1 := e2ethanos.NewStoreGW( @@ -296,7 +296,7 @@ func TestStoreGatewayNoCacheFile(t *testing.T) { "1", client.BucketConfig{ Type: client.S3, - Config: e2ethanos.NewS3Config(bucket, m.InternalEndpoint("https"), m.InternalDir()), + Config: e2ethanos.NewS3Config(bucket, m.InternalEndpoint("http"), m.InternalDir()), }, "", []string{"--no-cache-index-header"}, @@ -334,7 +334,7 @@ func TestStoreGatewayNoCacheFile(t *testing.T) { testutil.Ok(t, err) l := log.NewLogfmtLogger(os.Stdout) bkt, err := s3.NewBucketWithConfig(l, - e2ethanos.NewS3Config(bucket, m.Endpoint("https"), m.Dir()), "test-feed") + e2ethanos.NewS3Config(bucket, m.Endpoint("http"), m.Dir()), "test-feed") testutil.Ok(t, err) testutil.Ok(t, objstore.UploadDir(ctx, l, bkt, path.Join(dir, id1.String()), id1.String()))