Skip to content

Commit 81c7de5

Browse files
committed
disable parquet in updater by default
Signed-off-by: yeya24 <[email protected]>
1 parent 8dfaa9e commit 81c7de5

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

pkg/storage/tsdb/bucketindex/updater.go

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,9 @@ var (
3434

3535
// Updater is responsible to generate an update in-memory bucket index.
3636
type Updater struct {
37-
bkt objstore.InstrumentedBucket
38-
logger log.Logger
37+
bkt objstore.InstrumentedBucket
38+
logger log.Logger
39+
parquetEnabled bool
3940
}
4041

4142
func NewUpdater(bkt objstore.Bucket, userID string, cfgProvider bucket.TenantConfigProvider, logger log.Logger) *Updater {
@@ -45,6 +46,11 @@ func NewUpdater(bkt objstore.Bucket, userID string, cfgProvider bucket.TenantCon
4546
}
4647
}
4748

49+
func (w *Updater) EnableParquet() *Updater {
50+
w.parquetEnabled = true
51+
return w
52+
}
53+
4854
// UpdateIndex generates the bucket index and returns it, without storing it to the storage.
4955
// If the old index is not passed in input, then the bucket index will be generated from scratch.
5056
func (w *Updater) UpdateIndex(ctx context.Context, old *Index) (*Index, map[ulid.ULID]error, int64, error) {
@@ -104,7 +110,7 @@ func (w *Updater) updateBlocks(ctx context.Context, old []*Block, deletedBlocks
104110
// Check if parquet mark has been uploaded for the old block.
105111
// TODO: this should be optimized to have all parquet marker in a global path.
106112
// We assume parquet marker cannot be removed from a block if it exists before.
107-
if b.Parquet == nil {
113+
if w.parquetEnabled && b.Parquet == nil {
108114
if err := w.updateParquetBlockIndexEntry(ctx, b.ID, b); err != nil {
109115
return nil, nil, err
110116
}
@@ -119,7 +125,9 @@ func (w *Updater) updateBlocks(ctx context.Context, old []*Block, deletedBlocks
119125
for id := range discovered {
120126
b, err := w.updateBlockIndexEntry(ctx, id)
121127
if err == nil {
122-
err = w.updateParquetBlockIndexEntry(ctx, id, b)
128+
if w.parquetEnabled {
129+
err = w.updateParquetBlockIndexEntry(ctx, id, b)
130+
}
123131
if err == nil {
124132
blocks = append(blocks, b)
125133
continue

pkg/storage/tsdb/bucketindex/updater_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func TestUpdater_UpdateIndex_WithParquet(t *testing.T) {
319319
// Add parquet marker to block 1.
320320
block1ParquetMark := testutil.MockStorageParquetMark(t, bkt, userID, block1)
321321

322-
w := NewUpdater(bkt, userID, nil, logger)
322+
w := NewUpdater(bkt, userID, nil, logger).EnableParquet()
323323
returnedIdx, _, _, err := w.UpdateIndex(ctx, nil)
324324
require.NoError(t, err)
325325
assertBucketIndexEqualWithParquet(t, returnedIdx, bkt, userID,

pkg/storage/tsdb/testutil/block_mock.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"crypto/rand"
66
"encoding/json"
77
"fmt"
8-
cortex_tsdb "github.com/cortexproject/cortex/pkg/storage/tsdb"
98
"strings"
109
"testing"
1110
"time"
@@ -15,6 +14,8 @@ import (
1514
"github.com/stretchr/testify/require"
1615
"github.com/thanos-io/objstore"
1716
"github.com/thanos-io/thanos/pkg/block/metadata"
17+
18+
cortex_tsdb "github.com/cortexproject/cortex/pkg/storage/tsdb"
1819
)
1920

2021
func MockStorageBlock(t testing.TB, bucket objstore.Bucket, userID string, minT, maxT int64) tsdb.BlockMeta {

0 commit comments

Comments
 (0)