From a96768db4a901b04eff765888a3c327319047ebd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20=C5=A0tibran=C3=BD?= Date: Wed, 20 Jan 2021 16:33:44 +0100 Subject: [PATCH] Added bucket index flag, and enable bucket index by default. (#254) --- CHANGELOG.md | 1 + cortex/tsdb.libsonnet | 23 ++++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e31ab040..64c6708f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ - Cortex / Queries: added bucket index load operations and latency (available only when bucket index is enabled) - Alerts: added "CortexBucketIndexNotUpdated" (bucket index only) and "CortexTenantHasPartialBlocks" * [ENHANCEMENT] The name of the overrides configmap is now customisable via `$._config.overrides_configmap`. #244 +* [ENHANCEMENT] Added flag to control usage of bucket-index, and enable it by default when using blocks. #254 * [BUGFIX] Honor configured `per_instance_label` in all panels. #239 * [BUGFIX] `CortexRequestLatency` alert now ignores long-running requests on query-scheduler. #242 * [BUGFIX] Honor configured `job_names` in the "Memory (go heap inuse)" panel. #247 diff --git a/cortex/tsdb.libsonnet b/cortex/tsdb.libsonnet index eb43f885..92ecbf9b 100644 --- a/cortex/tsdb.libsonnet +++ b/cortex/tsdb.libsonnet @@ -24,6 +24,12 @@ // Allow to fine tune compactor. cortex_compactor_max_concurrency: 1, + // While this is the default value, we want to pass the same to the -blocks-storage.bucket-store.sync-interval + cortex_compactor_cleanup_interval: '15m', + + // Enable use of bucket index by querier, ruler and store-gateway. + // Bucket index is generated by compactor from Cortex 1.7, there is no flag required to enable this on compactor. + cortex_bucket_index_enabled: false, }, blocks_chunks_caching_config:: @@ -59,8 +65,15 @@ 'blocks-storage.bucket-store.metadata-cache.memcached.max-get-multi-batch-size': '100', } else {}, - querier_args+:: $.blocks_metadata_caching_config, - ruler_args+:: $.blocks_metadata_caching_config, + bucket_index_config:: if $._config.cortex_bucket_index_enabled then { + 'blocks-storage.bucket-store.bucket-index.enabled': true, + + // Bucket index is updated by compactor on each cleanup cycle. + 'blocks-storage.bucket-store.sync-interval': $._config.cortex_compactor_cleanup_interval, + } else {}, + + querier_args+:: $.blocks_metadata_caching_config + $.bucket_index_config, + ruler_args+:: $.blocks_metadata_caching_config + $.bucket_index_config, // The ingesters should persist TSDB blocks and WAL on a persistent // volume in order to be crash resilient. @@ -134,6 +147,7 @@ 'compactor.data-dir': '/data', 'compactor.compaction-interval': '30m', 'compactor.compaction-concurrency': $._config.cortex_compactor_max_concurrency, + 'compactor.cleanup-interval': $._config.cortex_compactor_cleanup_interval, // Enable sharding. 'compactor.sharding-enabled': true, @@ -189,7 +203,10 @@ // Persist ring tokens so that when the store-gateway will be restarted // it will pick the same tokens 'store-gateway.sharding-ring.tokens-file-path': '/data/tokens', - } + $.blocks_chunks_caching_config + $.blocks_metadata_caching_config, + } + + $.blocks_chunks_caching_config + + $.blocks_metadata_caching_config + + $.bucket_index_config, store_gateway_ports:: $.util.defaultPorts,