From dff3622eaa79c90c57f74b25c19cf4b1a228f925 Mon Sep 17 00:00:00 2001 From: Ashwanth Date: Mon, 28 Aug 2023 16:45:21 +0530 Subject: [PATCH] deprecate old index types and non-object stores (#10341) **What this PR does / why we need it**: Deprecates old index types: `aws, aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc`. Only `tsdb` and `boltdb-shipper` are supported. Deprecates non-object stores. The next major release might not allow the usage of these as `object_store` in `schema_config`: `aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc.` Deprecates table manager which is not needed once when using `boltdb-shipper` or `tsdb` index type **Which issue(s) this PR fixes**: Fixes # **Special notes for your reviewer**: **Checklist** - [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [ ] Documentation added - [ ] Tests updated - [x] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/setup/upgrade/_index.md` - [ ] For Helm chart changes bump the Helm chart version in `production/helm/loki/Chart.yaml` and update `production/helm/loki/CHANGELOG.md` and `production/helm/loki/README.md`. [Example PR](https://github.com/grafana/loki/commit/d10549e3ece02120974929894ee333d07755d213) --- CHANGELOG.md | 1 + docs/sources/configure/_index.md | 26 ++++++++------- pkg/loki/modules.go | 2 ++ .../client/aws/dynamodb_storage_client.go | 2 +- pkg/storage/config/schema_config.go | 6 ++-- pkg/storage/factory.go | 32 +++++++++++++++---- pkg/storage/factory_test.go | 2 +- 7 files changed, 48 insertions(+), 23 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7d8e0f1e77..37d3e05453 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -60,6 +60,7 @@ * [10302](https://github.com/grafana/loki/pull/10302) **ashwanthgoli**: Removes already deprecated `-querier.engine.timeout` CLI flag and corresponding YAML setting as well as the `querier.query_timeout` YAML setting. * [10301](https://github.com/grafana/loki/pull/10301) **wildum**: Promtail: users can now define `additional_fields` in cloudflare configuration. * [10308](https://github.com/grafana/loki/pull/10308) **bboreham** Tracing: elide small traces for Stats call. +* [10341](https://github.com/grafana/loki/pull/10341) **ashwanthgoli** Deprecate older index types and non-object stores - `aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc` * [10344](https://github.com/grafana/loki/pull/10344) **ashwanthgoli** Compactor: deprecate `-boltdb.shipper.compactor.` prefix in favor of `-compactor.`. ##### Fixes diff --git a/docs/sources/configure/_index.md b/docs/sources/configure/_index.md index 49adbecbd0..c644461b49 100644 --- a/docs/sources/configure/_index.md +++ b/docs/sources/configure/_index.md @@ -1708,8 +1708,8 @@ The `storage_config` block configures one of many possible stores for both the i # (BOS) object storage backend. [bos: ] -# Configures storing indexes in Bigtable. Required fields only required when -# bigtable is defined in config. +# Deprecated: Configures storing indexes in Bigtable. Required fields only +# required when bigtable is defined in config. bigtable: # Bigtable project ID. # CLI flag: -bigtable.project @@ -1738,7 +1738,7 @@ bigtable: # defined in config. [gcs: ] -# Configures storing chunks and/or the index in Cassandra. +# Deprecated: Configures storing chunks and/or the index in Cassandra. cassandra: # Comma-separated hostnames or IPs of Cassandra instances. # CLI flag: -cassandra.addresses @@ -1856,8 +1856,8 @@ cassandra: # CLI flag: -cassandra.table-options [table_options: | default = ""] -# Configures storing index in BoltDB. Required fields only required when boltdb -# is present in the configuration. +# Deprecated: Configures storing index in BoltDB. Required fields only required +# when boltdb is present in the configuration. boltdb: # Location of BoltDB index files. # CLI flag: -boltdb.dir @@ -1871,6 +1871,7 @@ boltdb: # Storage (Swift) object storage backend. [swift: ] +# Deprecated: grpc_store: # Hostname or IP of the gRPC store instance. # CLI flag: -grpc-store.server-address @@ -4123,14 +4124,16 @@ The `period_config` block configures what index schemas should be used for from # want the schema to switch over. In YYYY-MM-DD format, for example: 2018-04-15. [from: ] -# store and object_store below affect which key is used. -# Which store to use for the index. Either aws, aws-dynamo, gcp, bigtable, -# bigtable-hashed, cassandra, boltdb or boltdb-shipper. +# store and object_store below affect which key is used. Which +# index to use. Either tsdb or boltdb-shipper. Following stores are deprecated: +# aws, aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra, +# grpc. [store: | default = ""] -# Which store to use for the chunks. Either aws, azure, gcp, bigtable, gcs, -# cassandra, swift, filesystem or a named_store (refer to named_stores_config). -# If omitted, defaults to the same value as store. +# Which store to use for the chunks. Either aws (alias s3), azure, gcs, +# alibabacloud, bos, cos, swift, filesystem, or a named_store (refer to +# named_stores_config). Following stores are deprecated: aws-dynamo, gcp, +# gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc. [object_store: | default = ""] # The schema version to use, current recommended schema is v12. @@ -4167,6 +4170,7 @@ chunks: The `aws_storage_config` block configures the connection to dynamoDB and S3 object storage. Either one of them or both can be configured. ```yaml +# Deprecated: Configures storing indexes in DynamoDB. dynamodb: # DynamoDB endpoint URL with escaped Key and Secret encoded. If only region is # specified as a host, proper endpoint will be deduced. Use diff --git a/pkg/loki/modules.go b/pkg/loki/modules.go index 121b173da0..77d7098371 100644 --- a/pkg/loki/modules.go +++ b/pkg/loki/modules.go @@ -507,6 +507,8 @@ func (t *Loki) initIngester() (_ services.Service, err error) { } func (t *Loki) initTableManager() (services.Service, error) { + level.Warn(util_log.Logger).Log("msg", "table manager is deprecated. Consider migrating to tsdb index which relies on a compactor instead.") + err := t.Cfg.SchemaConfig.Load() if err != nil { return nil, err diff --git a/pkg/storage/chunk/client/aws/dynamodb_storage_client.go b/pkg/storage/chunk/client/aws/dynamodb_storage_client.go index d426f2a571..d27985ce3e 100644 --- a/pkg/storage/chunk/client/aws/dynamodb_storage_client.go +++ b/pkg/storage/chunk/client/aws/dynamodb_storage_client.go @@ -84,7 +84,7 @@ func (cfg *DynamoDBConfig) RegisterFlags(f *flag.FlagSet) { // StorageConfig specifies config for storing data on AWS. type StorageConfig struct { - DynamoDBConfig `yaml:"dynamodb"` + DynamoDBConfig `yaml:"dynamodb" doc:"description=Deprecated: Configures storing indexes in DynamoDB."` S3Config `yaml:",inline"` } diff --git a/pkg/storage/config/schema_config.go b/pkg/storage/config/schema_config.go index 5bf215049d..11a0948a58 100644 --- a/pkg/storage/config/schema_config.go +++ b/pkg/storage/config/schema_config.go @@ -156,9 +156,9 @@ type PeriodConfig struct { // used when working with config From DayTime `yaml:"from" doc:"description=The date of the first day that index buckets should be created. Use a date in the past if this is your only period_config, otherwise use a date when you want the schema to switch over. In YYYY-MM-DD format, for example: 2018-04-15."` // type of index client to use. - IndexType string `yaml:"store" doc:"description=store and object_store below affect which key is used.\nWhich store to use for the index. Either aws, aws-dynamo, gcp, bigtable, bigtable-hashed, cassandra, boltdb or boltdb-shipper. "` - // type of object client to use; if omitted, defaults to store. - ObjectType string `yaml:"object_store" doc:"description=Which store to use for the chunks. Either aws, azure, gcp, bigtable, gcs, cassandra, swift, filesystem or a named_store (refer to named_stores_config). If omitted, defaults to the same value as store."` + IndexType string `yaml:"store" doc:"description=store and object_store below affect which key is used. Which index to use. Either tsdb or boltdb-shipper. Following stores are deprecated: aws, aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc."` + // type of object client to use. + ObjectType string `yaml:"object_store" doc:"description=Which store to use for the chunks. Either aws (alias s3), azure, gcs, alibabacloud, bos, cos, swift, filesystem, or a named_store (refer to named_stores_config). Following stores are deprecated: aws-dynamo, gcp, gcp-columnkey, bigtable, bigtable-hashed, cassandra, grpc."` Schema string `yaml:"schema" doc:"description=The schema version to use, current recommended schema is v12."` IndexTables PeriodicTableConfig `yaml:"index" doc:"description=Configures how the index is updated and stored."` ChunkTables PeriodicTableConfig `yaml:"chunks" doc:"description=Configured how the chunks are updated and stored."` diff --git a/pkg/storage/factory.go b/pkg/storage/factory.go index 6d784d893a..758327f7e6 100644 --- a/pkg/storage/factory.go +++ b/pkg/storage/factory.go @@ -269,13 +269,13 @@ type Config struct { AWSStorageConfig aws.StorageConfig `yaml:"aws"` AzureStorageConfig azure.BlobStorageConfig `yaml:"azure"` BOSStorageConfig baidubce.BOSStorageConfig `yaml:"bos"` - GCPStorageConfig gcp.Config `yaml:"bigtable" doc:"description=Configures storing indexes in Bigtable. Required fields only required when bigtable is defined in config."` + GCPStorageConfig gcp.Config `yaml:"bigtable" doc:"description=Deprecated: Configures storing indexes in Bigtable. Required fields only required when bigtable is defined in config."` GCSConfig gcp.GCSConfig `yaml:"gcs" doc:"description=Configures storing chunks in GCS. Required fields only required when gcs is defined in config."` - CassandraStorageConfig cassandra.Config `yaml:"cassandra" doc:"description=Configures storing chunks and/or the index in Cassandra."` - BoltDBConfig local.BoltDBConfig `yaml:"boltdb" doc:"description=Configures storing index in BoltDB. Required fields only required when boltdb is present in the configuration."` + CassandraStorageConfig cassandra.Config `yaml:"cassandra" doc:"description=Deprecated: Configures storing chunks and/or the index in Cassandra."` + BoltDBConfig local.BoltDBConfig `yaml:"boltdb" doc:"description=Deprecated: Configures storing index in BoltDB. Required fields only required when boltdb is present in the configuration."` FSConfig local.FSConfig `yaml:"filesystem" doc:"description=Configures storing the chunks on the local file system. Required fields only required when filesystem is present in the configuration."` Swift openstack.SwiftConfig `yaml:"swift"` - GrpcConfig grpc.Config `yaml:"grpc_store"` + GrpcConfig grpc.Config `yaml:"grpc_store" doc:"deprecated"` Hedging hedging.Config `yaml:"hedging"` NamedStores NamedStores `yaml:"named_stores"` COSConfig ibmcloud.COSConfig `yaml:"cos"` @@ -358,6 +358,8 @@ func NewIndexClient(periodCfg config.PeriodConfig, tableRange config.TableRange, store := testutils.NewMockStorage() return store, nil case config.StorageTypeAWS, config.StorageTypeAWSDynamo: + level.Warn(util_log.Logger).Log("msg", fmt.Sprintf("%s is deprecated. Consider migrating to tsdb", periodCfg.IndexType)) + if cfg.AWSStorageConfig.DynamoDB.URL == nil { return nil, fmt.Errorf("Must set -dynamodb.url in aws mode") } @@ -367,17 +369,23 @@ func NewIndexClient(periodCfg config.PeriodConfig, tableRange config.TableRange, } return aws.NewDynamoDBIndexClient(cfg.AWSStorageConfig.DynamoDBConfig, schemaCfg, registerer) case config.StorageTypeGCP: + level.Warn(util_log.Logger).Log("msg", "gcp is deprecated. Consider migrating to tsdb") return gcp.NewStorageClientV1(context.Background(), cfg.GCPStorageConfig, schemaCfg) case config.StorageTypeGCPColumnKey, config.StorageTypeBigTable: + level.Warn(util_log.Logger).Log("msg", fmt.Sprintf("%s is deprecated. Consider migrating to tsdb", periodCfg.IndexType)) return gcp.NewStorageClientColumnKey(context.Background(), cfg.GCPStorageConfig, schemaCfg) case config.StorageTypeBigTableHashed: + level.Warn(util_log.Logger).Log("msg", "bigtable-hashed is deprecated. Consider migrating to tsdb") cfg.GCPStorageConfig.DistributeKeys = true return gcp.NewStorageClientColumnKey(context.Background(), cfg.GCPStorageConfig, schemaCfg) case config.StorageTypeCassandra: + level.Warn(util_log.Logger).Log("msg", "cassandra is deprecated. Consider migrating to tsdb") return cassandra.NewStorageClient(cfg.CassandraStorageConfig, schemaCfg, registerer) case config.StorageTypeBoltDB: + level.Warn(util_log.Logger).Log("msg", "local boltdb index is deprecated. Consider migrating to tsdb") return local.NewBoltDBIndexClient(cfg.BoltDBConfig) case config.StorageTypeGrpc: + level.Warn(util_log.Logger).Log("msg", "grpc-store is deprecated. Consider migrating to tsdb") return grpc.NewStorageClient(cfg.GrpcConfig, schemaCfg) case config.BoltDBShipperType: if shouldUseIndexGatewayClient(cfg.BoltDBShipperConfig.Config) { @@ -420,7 +428,7 @@ func NewIndexClient(periodCfg config.PeriodConfig, tableRange config.TableRange, boltdbIndexClientsWithShipper[periodCfg.From] = shipper return shipper, nil default: - return nil, fmt.Errorf("Unrecognized storage client %v, choose one of: %v, %v, %v, %v, %v, %v", periodCfg.IndexType, config.StorageTypeAWS, config.StorageTypeCassandra, config.StorageTypeInMemory, config.StorageTypeGCP, config.StorageTypeBigTable, config.StorageTypeBigTableHashed) + return nil, fmt.Errorf("Unrecognized storage client %v, choose one of: %v, %v", periodCfg.IndexType, config.BoltDBShipperType, config.TSDBType) } } @@ -435,6 +443,10 @@ func NewChunkClient(name string, cfg Config, schemaCfg config.SchemaConfig, cc c storeType = nsType } + supportedStores := []string{config.StorageTypeAWS, config.StorageTypeS3, config.StorageTypeAzure, config.StorageTypeAlibabaCloud, + config.StorageTypeBOS, config.StorageTypeGCS, config.StorageTypeSwift, + config.StorageTypeFileSystem, config.StorageTypeCOS} + switch storeType { case config.StorageTypeInMemory: return testutils.NewMockStorage(), nil @@ -445,6 +457,8 @@ func NewChunkClient(name string, cfg Config, schemaCfg config.SchemaConfig, cc c } return client.NewClientWithMaxParallel(c, nil, cfg.MaxParallelGetChunk, schemaCfg), nil case config.StorageTypeAWSDynamo: + level.Warn(util_log.Logger).Log("msg", "aws-dynamo is deprecated. Please use one of the supported object stores: "+strings.Join(supportedStores, ", ")) + if cfg.AWSStorageConfig.DynamoDB.URL == nil { return nil, fmt.Errorf("Must set -dynamodb.url in aws mode") } @@ -472,8 +486,10 @@ func NewChunkClient(name string, cfg Config, schemaCfg config.SchemaConfig, cc c } return client.NewClientWithMaxParallel(c, nil, cfg.MaxChunkBatchSize, schemaCfg), nil case config.StorageTypeGCP: + level.Warn(util_log.Logger).Log("msg", "gcp is deprecated. Please use one of the supported object stores: "+strings.Join(supportedStores, ", ")) return gcp.NewBigtableObjectClient(context.Background(), cfg.GCPStorageConfig, schemaCfg) case config.StorageTypeGCPColumnKey, config.StorageTypeBigTable, config.StorageTypeBigTableHashed: + level.Warn(util_log.Logger).Log("msg", fmt.Sprintf("%s is deprecated. Please use one of the supported object stores: %s", storeType, strings.Join(supportedStores, ", "))) return gcp.NewBigtableObjectClient(context.Background(), cfg.GCPStorageConfig, schemaCfg) case config.StorageTypeGCS: c, err := NewObjectClient(name, cfg, clientMetrics) @@ -495,6 +511,7 @@ func NewChunkClient(name string, cfg Config, schemaCfg config.SchemaConfig, cc c } return client.NewClientWithMaxParallel(c, nil, cfg.MaxParallelGetChunk, schemaCfg), nil case config.StorageTypeCassandra: + level.Warn(util_log.Logger).Log("msg", "cassandra is deprecated. Please use one of the supported object stores: "+strings.Join(supportedStores, ", ")) return cassandra.NewObjectClient(cfg.CassandraStorageConfig, schemaCfg, registerer, cfg.MaxParallelGetChunk) case config.StorageTypeFileSystem: c, err := NewObjectClient(name, cfg, clientMetrics) @@ -503,6 +520,7 @@ func NewChunkClient(name string, cfg Config, schemaCfg config.SchemaConfig, cc c } return client.NewClientWithMaxParallel(c, client.FSEncoder, cfg.MaxParallelGetChunk, schemaCfg), nil case config.StorageTypeGrpc: + level.Warn(util_log.Logger).Log("msg", "grpc-store is deprecated. Please use one of the supported object stores: "+strings.Join(supportedStores, ", ")) return grpc.NewStorageClient(cfg.GrpcConfig, schemaCfg) case config.StorageTypeCOS: c, err := NewObjectClient(name, cfg, clientMetrics) @@ -511,7 +529,7 @@ func NewChunkClient(name string, cfg Config, schemaCfg config.SchemaConfig, cc c } return client.NewClientWithMaxParallel(c, nil, cfg.MaxParallelGetChunk, schemaCfg), nil default: - return nil, fmt.Errorf("Unrecognized storage client %v, choose one of: %v, %v, %v, %v, %v, %v, %v, %v, %v", name, config.StorageTypeAWS, config.StorageTypeAzure, config.StorageTypeCassandra, config.StorageTypeInMemory, config.StorageTypeGCP, config.StorageTypeBigTable, config.StorageTypeBigTableHashed, config.StorageTypeGrpc, config.StorageTypeCOS) + return nil, fmt.Errorf("Unrecognized storage client %v, choose one of: %v", name, strings.Join(supportedStores, ", ")) } } @@ -704,6 +722,6 @@ func NewObjectClient(name string, cfg Config, clientMetrics ClientMetrics) (clie } return ibmcloud.NewCOSObjectClient(cosCfg, cfg.Hedging) default: - return nil, fmt.Errorf("Unrecognized storage client %v, choose one of: %v, %v, %v, %v, %v, %v", name, config.StorageTypeAWS, config.StorageTypeS3, config.StorageTypeGCS, config.StorageTypeAzure, config.StorageTypeFileSystem, config.StorageTypeCOS) + return nil, fmt.Errorf("Unrecognized storage client %v, choose one of: %v, %v, %v, %v, %v, %v, %v, %v, %v", name, config.StorageTypeAWS, config.StorageTypeS3, config.StorageTypeGCS, config.StorageTypeAzure, config.StorageTypeAlibabaCloud, config.StorageTypeSwift, config.StorageTypeBOS, config.StorageTypeCOS, config.StorageTypeFileSystem) } } diff --git a/pkg/storage/factory_test.go b/pkg/storage/factory_test.go index ac71fb1c15..3d49d1d606 100644 --- a/pkg/storage/factory_test.go +++ b/pkg/storage/factory_test.go @@ -162,7 +162,7 @@ func TestNamedStores(t *testing.T) { schemaConfig.Configs[0].ObjectType = "not-found" _, err := NewStore(cfg, config.ChunkStoreConfig{}, schemaConfig, limits, cm, nil, util_log.Logger) require.Error(t, err) - require.Contains(t, err.Error(), "Unrecognized storage client not-found, choose one of: aws, azure, cassandra, inmemory, gcp, bigtable, bigtable-hashed, grpc-store") + require.Contains(t, err.Error(), "Unrecognized storage client not-found, choose one of: aws, s3, azure, alibabacloud, bos, gcs, swift, filesystem, cos") }) }