Skip to content

Commit

Permalink
Fixes the index-gateway when using the ring (grafana#5923)
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
  • Loading branch information
cyriltovena authored Apr 14, 2022
1 parent c7cbeab commit 681195f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/loki/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,7 @@ func (t *Loki) initStore() (_ services.Service, err error) {
asyncStore = true
case t.Cfg.isModuleEnabled(IndexGateway):
// we want to use the actual storage when running the index-gateway, so we remove the Addr from the config
t.Cfg.StorageConfig.BoltDBShipperConfig.IndexGatewayClientConfig.Address = ""
t.Cfg.StorageConfig.BoltDBShipperConfig.IndexGatewayClientConfig.Disabled = true
case t.Cfg.isModuleEnabled(All):
// We want ingester to also query the store when using boltdb-shipper but only when running with target All.
// We do not want to use AsyncStore otherwise it would start spiraling around doing queries over and over again to the ingesters and store.
Expand Down
2 changes: 1 addition & 1 deletion pkg/storage/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func (s *store) chunkClientForPeriod(p config.PeriodConfig) (client.Client, erro
}

func shouldUseIndexGatewayClient(cfg Config) bool {
if cfg.BoltDBShipperConfig.Mode != shipper.ModeReadOnly {
if cfg.BoltDBShipperConfig.Mode != shipper.ModeReadOnly || cfg.BoltDBShipperConfig.IndexGatewayClientConfig.Disabled {
return false
}

Expand Down
4 changes: 4 additions & 0 deletions pkg/storage/stores/shipper/gateway_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ type IndexGatewayClientConfig struct {
//
// Only relevant for the simple mode.
Address string `yaml:"server_address,omitempty"`

// Forcefully disable the use of the index gateway client for the storage.
// This is mainly useful for the index-gateway component which should always use the storage.
Disabled bool `yaml:"-"`
}

// RegisterFlagsWithPrefix register client-specific flags with the given prefix.
Expand Down

0 comments on commit 681195f

Please sign in to comment.