Skip to content

Commit 15c7117

Browse files
committed
store gateway flag to pick the ParquetBucketStores
1 parent 3c2229f commit 15c7117

File tree

4 files changed

+29
-6
lines changed

4 files changed

+29
-6
lines changed

pkg/storegateway/gateway.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ type Config struct {
6161

6262
EnabledTenants flagext.StringSliceCSV `yaml:"enabled_tenants" category:"advanced"`
6363
DisabledTenants flagext.StringSliceCSV `yaml:"disabled_tenants" category:"advanced"`
64+
65+
ParquetEnabled bool `yaml:"parquet_enabled" category:"experimental"`
6466
}
6567

6668
// RegisterFlags registers the Config flags.
@@ -70,6 +72,8 @@ func (cfg *Config) RegisterFlags(f *flag.FlagSet, logger log.Logger) {
7072

7173
f.Var(&cfg.EnabledTenants, "store-gateway.enabled-tenants", "Comma separated list of tenants that can be loaded by the store-gateway. If specified, only blocks for these tenants will be loaded by the store-gateway, otherwise all tenants can be loaded. Subject to sharding.")
7274
f.Var(&cfg.DisabledTenants, "store-gateway.disabled-tenants", "Comma separated list of tenants that cannot be loaded by the store-gateway. If specified, and the store-gateway would normally load a given tenant for (via -store-gateway.enabled-tenants or sharding), it will be ignored instead.")
75+
76+
f.BoolVar(&cfg.ParquetEnabled, "store-gateway.enabled-tenants", false, "Whether to query Parquet files for block instead of the native Prometheus TSDB files.")
7377
}
7478

7579
// Validate the Config.
@@ -94,7 +98,7 @@ type StoreGateway struct {
9498
gatewayCfg Config
9599
storageCfg mimir_tsdb.BlocksStorageConfig
96100
logger log.Logger
97-
stores *BucketStores
101+
stores Stores
98102
tracker *activitytracker.ActivityTracker
99103

100104
// Ring used for sharding blocks.

pkg/storegateway/gateway_blocks_http.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func (s *StoreGateway) BlocksHandler(w http.ResponseWriter, req *http.Request) {
8282
}
8383
}
8484

85-
metasMap, deleteMarkerDetails, noCompactMarkerDetails, err := listblocks.LoadMetaFilesAndMarkers(req.Context(), s.stores.bucket, tenantID, showDeleted, time.Time{})
85+
metasMap, deleteMarkerDetails, noCompactMarkerDetails, err := listblocks.LoadMetaFilesAndMarkers(req.Context(), s.stores.(*BucketStores).bucket, tenantID, showDeleted, time.Time{})
8686
if err != nil {
8787
util.WriteTextResponse(w, fmt.Sprintf("Failed to read block metadata: %s", err))
8888
return

pkg/storegateway/gateway_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,9 @@ func TestStoreGateway_InitialSyncWithDefaultShardingEnabled(t *testing.T) {
176176
assert.Equal(t, ringNumTokensDefault, len(g.ringLifecycler.GetTokens()))
177177
assert.Subset(t, g.ringLifecycler.GetTokens(), testData.initialTokens)
178178

179-
assert.NotNil(t, g.stores.getStore("user-1"))
180-
assert.NotNil(t, g.stores.getStore("user-2"))
181-
assert.Nil(t, g.stores.getStore("user-unknown"))
179+
assert.NotNil(t, g.stores.(*BucketStores).getStore("user-1"))
180+
assert.NotNil(t, g.stores.(*BucketStores).getStore("user-2"))
181+
assert.Nil(t, g.stores.(*BucketStores).getStore("user-unknown"))
182182
})
183183
}
184184
}
@@ -770,7 +770,7 @@ func TestStoreGateway_SyncShouldKeepPreviousBlocksIfInstanceIsUnhealthyInTheRing
770770
srv := newStoreGatewayTestServer(t, g)
771771

772772
// No sync retries to speed up tests.
773-
g.stores.syncBackoffConfig = backoff.Config{MaxRetries: 1}
773+
g.stores.(*BucketStores).syncBackoffConfig = backoff.Config{MaxRetries: 1}
774774

775775
// Start the store-gateway.
776776
require.NoError(t, services.StartAndAwaitRunning(ctx, g))

pkg/storegateway/stores.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package storegateway
2+
3+
import (
4+
"context"
5+
6+
"github.com/grafana/dskit/services"
7+
"github.com/grafana/mimir/pkg/storegateway/storegatewaypb"
8+
"github.com/grafana/mimir/pkg/storegateway/storepb"
9+
)
10+
11+
type Stores interface {
12+
services.Service
13+
Series(req *storepb.SeriesRequest, srv storegatewaypb.StoreGateway_SeriesServer) error
14+
LabelNames(ctx context.Context, req *storepb.LabelNamesRequest) (*storepb.LabelNamesResponse, error)
15+
LabelValues(ctx context.Context, req *storepb.LabelValuesRequest) (*storepb.LabelValuesResponse, error)
16+
SyncBlocks(ctx context.Context) error
17+
18+
scanUsers(context.Context) ([]string, error)
19+
}

0 commit comments

Comments
 (0)