From 5b02d5d24aa7c910bb61c94d8f0216b9329b9df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Wed, 20 Jan 2021 14:48:09 +0100 Subject: [PATCH 1/5] Added option to enable bucket index. --- cortex/tsdb.libsonnet | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/cortex/tsdb.libsonnet b/cortex/tsdb.libsonnet index eb43f885..a04b0640 100644 --- a/cortex/tsdb.libsonnet +++ b/cortex/tsdb.libsonnet @@ -24,6 +24,11 @@ // Allow to fine tune compactor. cortex_compactor_max_concurrency: 1, + cortex_compactor_cleanup_interval: '15m', // Default value, we want to pass the same to the -blocks-storage.bucket-store.sync-interval + + // 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 compactor. + cortex_bucket_index_enabled: false, }, blocks_chunks_caching_config:: @@ -59,8 +64,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 +146,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 +202,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, From 177cb75221947aa1ce470e5ae31af45e09169391 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Wed, 20 Jan 2021 15:03:10 +0100 Subject: [PATCH 2/5] Enable bucket index by default. --- cortex/tsdb.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cortex/tsdb.libsonnet b/cortex/tsdb.libsonnet index a04b0640..45de74e5 100644 --- a/cortex/tsdb.libsonnet +++ b/cortex/tsdb.libsonnet @@ -28,7 +28,7 @@ // 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 compactor. - cortex_bucket_index_enabled: false, + cortex_bucket_index_enabled: true, }, blocks_chunks_caching_config:: From 872314e22f550be3682483b5016574130dfaad58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Wed, 20 Jan 2021 15:05:06 +0100 Subject: [PATCH 3/5] CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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 From 42c2d2596996cb5bba6035f496f1a96216a93574 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Wed, 20 Jan 2021 15:16:39 +0100 Subject: [PATCH 4/5] Update comments. --- cortex/tsdb.libsonnet | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cortex/tsdb.libsonnet b/cortex/tsdb.libsonnet index 45de74e5..d40bc99e 100644 --- a/cortex/tsdb.libsonnet +++ b/cortex/tsdb.libsonnet @@ -24,10 +24,11 @@ // Allow to fine tune compactor. cortex_compactor_max_concurrency: 1, - cortex_compactor_cleanup_interval: '15m', // Default value, we want to pass the same to the -blocks-storage.bucket-store.sync-interval + // 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 compactor. + // Bucket index is generated by compactor from Cortex 1.7, there is no flag required to enable this on compactor. cortex_bucket_index_enabled: true, }, From 6b08542a736500b0c556f55ae8d14cdc6036b388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20S=CC=8Ctibrany=CC=81?= Date: Wed, 20 Jan 2021 15:28:56 +0100 Subject: [PATCH 5/5] Change default. --- cortex/tsdb.libsonnet | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cortex/tsdb.libsonnet b/cortex/tsdb.libsonnet index d40bc99e..92ecbf9b 100644 --- a/cortex/tsdb.libsonnet +++ b/cortex/tsdb.libsonnet @@ -29,7 +29,7 @@ // 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: true, + cortex_bucket_index_enabled: false, }, blocks_chunks_caching_config::