Logcli: load remote schema before validation (#7258)

The --remote-schema option didn't work as validation would be called
before the remote schema was loaded. An error about a missing schema
section is the result. This was tested by running against a remote
bucket containing a schemaconfig.yaml file with a local config file that
does not contain a schema config section.

Signed-off-by: Michel Hollands <michel.hollands@grafana.com>
pull/7268/head
Michel Hollands 3 years ago committed by GitHub
parent dcfba366de
commit 391b9cea10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 28
      pkg/logcli/query/query.go

@ -190,21 +190,8 @@ func (q *Query) DoLocalQuery(out output.LogOutput, statistics bool, orgID string
return err
}
if err := conf.Validate(); err != nil {
return err
}
limits, err := validation.NewOverrides(conf.LimitsConfig, nil)
if err != nil {
return err
}
cm := storage.NewClientMetrics()
conf.StorageConfig.BoltDBShipperConfig.Mode = indexshipper.ModeReadOnly
conf.StorageConfig.BoltDBShipperConfig.IndexGatewayClientConfig.Disabled = true
schema := conf.SchemaConfig
if useRemoteSchema {
cm := storage.NewClientMetrics()
client, err := GetObjectClient(conf, cm)
if err != nil {
return err
@ -215,10 +202,21 @@ func (q *Query) DoLocalQuery(out output.LogOutput, statistics bool, orgID string
return err
}
schema = *loadedSchema
conf.SchemaConfig = *loadedSchema
}
querier, err := storage.NewStore(conf.StorageConfig, conf.ChunkStoreConfig, schema, limits, cm, prometheus.DefaultRegisterer, util_log.Logger)
if err := conf.Validate(); err != nil {
return err
}
limits, err := validation.NewOverrides(conf.LimitsConfig, nil)
if err != nil {
return err
}
conf.StorageConfig.BoltDBShipperConfig.Mode = indexshipper.ModeReadOnly
conf.StorageConfig.BoltDBShipperConfig.IndexGatewayClientConfig.Disabled = true
querier, err := storage.NewStore(conf.StorageConfig, conf.ChunkStoreConfig, conf.SchemaConfig, limits, cm, prometheus.DefaultRegisterer, util_log.Logger)
if err != nil {
return err
}

Loading…
Cancel
Save