-
Notifications
You must be signed in to change notification settings - Fork 535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable bucket index by default #924
Conversation
1d02f04
to
f9e6c8d
Compare
Thanks for working on this! I agree on enabling it by default. Changing all integration tests could be annoying (and would make them even more fragile cause we have to run compactor, wait for it, ...). I would suggest to selectively disable |
f9e6c8d
to
df5344a
Compare
I'll work on this PR next week. I'm having some issues running integration tests locally that I still haven't been able to resolve. |
Feel free to reach out if you need help. |
843f946
to
208efc3
Compare
I was able to iterate on the integration tests locally. They still fail when trying to run too many at once, but that wasn't a blocker here. Thanks to @treid314 for helping me look at the last unit test failure, which was an interaction with a mock not expecting index read attempts. |
36dd1c0
to
ad7f7e2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job! I left few minor comments I would be glad to see addressed before we merge it.
@@ -434,5 +434,7 @@ | |||
|
|||
// Bucket index is updated by compactor on each cleanup cycle. | |||
'blocks-storage.bucket-store.sync-interval': $._config.compactor_cleanup_interval, | |||
} else {}, | |||
} else { | |||
'blocks-storage.bucket-store.bucket-index.enabled': false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would do the opposite in our jsonnet. If bucket_index_enabled
is true (and you change the default it to true) then we don't add blocks-storage.bucket-store.bucket-index.enabled': true,
because that's the default, otherwise we add 'blocks-storage.bucket-store.bucket-index.enabled': false,
as you did.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I understand correctly, you wanted the blocks-storage.bucket-store.bucket-index.enabled': true
to be deleted. I remember wondering about this when I made the change. Is the intention to never set flags that are defaults to minimize the configuration and let future changes be picked up more easily?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention to never set flags that are defaults to minimize the configuration and let future changes be picked up more easily?
Yes, that's the idea, whenever it makes sense. I think in this case it does.
pkg/storage/tsdb/config.go
Outdated
@@ -340,7 +340,7 @@ type BucketIndexConfig struct { | |||
} | |||
|
|||
func (cfg *BucketIndexConfig) RegisterFlagsWithPrefix(f *flag.FlagSet, prefix string) { | |||
f.BoolVar(&cfg.Enabled, prefix+"enabled", false, "True to enable querier and store-gateway to discover blocks in the storage via bucket index instead of bucket scanning.") | |||
f.BoolVar(&cfg.Enabled, prefix+"enabled", true, "If enabled, a querier/store-gateway can discover blocks by reading a bucket index instead of bucket scanning.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] I just wanna make sure it's not they "can" (as an option) but they only discover blocks this way.
f.BoolVar(&cfg.Enabled, prefix+"enabled", true, "If enabled, a querier/store-gateway can discover blocks by reading a bucket index instead of bucket scanning.") | |
f.BoolVar(&cfg.Enabled, prefix+"enabled", true, "If enabled, queriers and store-gateways discover blocks by reading a bucket index (created and updated by the compactor) instead of periodically scanning the bucket.") |
CHANGELOG.md
Outdated
@@ -256,6 +256,7 @@ | |||
* [CHANGE] Alertmanager: `-experimental.alertmanager.enable-api` flag has been renamed to `-alertmanager.enable-api` and is now stable. #913 | |||
* [CHANGE] Ingester: changed default value of `-blocks-storage.tsdb.retention-period` from `6h` to `24h`. #966 | |||
* [CHANGE] Changed default value of `-querier.query-ingesters-within` and `-blocks-storage.tsdb.close-idle-tsdb-timeout` from `0` to `13h`. #966 | |||
* [CHANGE] Changed the default value of `-blocks-storage.bucket-store.bucket-index.enabled` to `true`. #924 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also mention that this means that running compactor is mandatory with the default configuration, because the bucket index is written by the compactor and if it's missing queries on long-term storage will not work.
@@ -60,7 +60,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. | |||
bucket_index_enabled: false, | |||
bucket_index_enabled: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please mention this change in the CHANGELOG section related to the mixin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't even realize that was a section of the CHANGELOG. Is the following sufficient or should it also mention the compactor requirement?
[CHANGE] Changed the default of `bucket_index_enabled` to `true`. #924
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to mention the compactor requirement because if you use our jsonnet the compactor is already always running.
CHANGELOG section related to the mixin.
I made a mistake. Not the mixin, but the jsonnet one (they're 2 distinct sections). Mixin is just dashboards + alerts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 swapped to the jsonnet section.
@@ -34,7 +34,7 @@ The `bucket-index.json.gz` contains: | |||
|
|||
The [compactor](./compactor.md) periodically scans the bucket and uploads an updated bucket index to the storage. The frequency at which the bucket index is updated can be configured via `-compactor.cleanup-interval`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At the top of this file you can find:
The bucket index usage is optional and can be enabled via
-blocks-storage.bucket-store.bucket-index.enabled=true
(or its respective YAML config option).
Could you rephrase it to clarify that it's enabled by default, please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can say something like: bucket index is enabled by default,b ut can be disabled via -blocks-storage.bucket-store.bucket-index.enabled=false
(not recommended).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Went with:
The bucket index is enabled by default, but it is optional. It can be disabled via
-blocks-storage.bucket-store.bucket-index.enabled=false
(or its respective YAML config option). Disabling the bucket index is not recommended.
03b8c8f
to
007c1fc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM (modulo a nit I'm just going to merge)
@@ -434,5 +434,7 @@ | |||
|
|||
// Bucket index is updated by compactor on each cleanup cycle. | |||
'blocks-storage.bucket-store.sync-interval': $._config.compactor_cleanup_interval, | |||
} else {}, | |||
} else { | |||
'blocks-storage.bucket-store.bucket-index.enabled': false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the intention to never set flags that are defaults to minimize the configuration and let future changes be picked up more easily?
Yes, that's the idea, whenever it makes sense. I think in this case it does.
Signed-off-by: Marco Pracucci <[email protected]>
Thanks for the help with getting this in! |
What this PR does:
Enables the bucket index by default
WIP: Looking into the test failuresWhich issue(s) this PR fixes:
Fixes https://github.com/grafana/mimir-squad/issues/498
Checklist
CHANGELOG.md
updated - the order of entries should be[CHANGE]
,[FEATURE]
,[ENHANCEMENT]
,[BUGFIX]