Skip to content

Commit

Permalink
fix bug
Browse files Browse the repository at this point in the history
Signed-off-by: wanjunlei <wanjunlei@kubesphere.io>
  • Loading branch information
wanjunlei authored and wanjunlei committed Jan 28, 2023
1 parent 1f04ccb commit 4be4ab3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pkg/block/indexheader/binary_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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})
}

Expand All @@ -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})
}
Expand Down
6 changes: 3 additions & 3 deletions test/e2e/store_gateway_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -288,15 +288,15 @@ 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(
e,
"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"},
Expand Down Expand Up @@ -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()))
Expand Down

0 comments on commit 4be4ab3

Please sign in to comment.