-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
refactor(bloom planner): Compute gaps and build tasks from metas and TSDBs #12994
Merged
Merged
Changes from 8 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
2c82bbd
Add configs and limits
salvacorts 872f7ac
run on interval
salvacorts 5570b38
Iterate tenants and split FP keyspace into factor
salvacorts 9d4e94d
Compute ownership gaps
salvacorts 58f410a
Build tasks
salvacorts bb6b3d9
Add tests
salvacorts 8d8495f
update docs
salvacorts 35b9d2d
lint
salvacorts 6020b91
CR feedback
salvacorts c9c3036
Add limits
salvacorts 0a347cc
Remove queue field
salvacorts File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,40 @@ | ||
package planner | ||
|
||
import "flag" | ||
import ( | ||
"flag" | ||
"fmt" | ||
"time" | ||
) | ||
|
||
// Config configures the bloom-planner component. | ||
type Config struct { | ||
// TODO: Add config | ||
PlanningInterval time.Duration `yaml:"planning_interval"` | ||
MinTableOffset int `yaml:"min_table_offset"` | ||
MaxTableOffset int `yaml:"max_table_offset"` | ||
} | ||
|
||
// RegisterFlagsWithPrefix registers flags for the bloom-planner configuration. | ||
func (cfg *Config) RegisterFlagsWithPrefix(_ string, _ *flag.FlagSet) { | ||
// TODO: Register flags with flagsPrefix | ||
func (cfg *Config) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet) { | ||
f.DurationVar(&cfg.PlanningInterval, prefix+".interval", 10*time.Minute, "Interval at which to re-run the bloom creation planning.") | ||
f.IntVar(&cfg.MinTableOffset, prefix+".min-table-offset", 1, "Newest day-table offset (from today, inclusive) to build blooms for. Increase to lower cost by not re-writing data to object storage too frequently since recent data changes more often at the cost of not having blooms available as quickly.") | ||
// TODO(owen-d): ideally we'd set this per tenant based on their `reject_old_samples_max_age` setting, | ||
// but due to how we need to discover tenants, we can't do that yet. Tenant+Period discovery is done by | ||
// iterating the table periods in object storage and looking for tenants within that period. | ||
// In order to have this done dynamically, we'd need to account for tenant specific overrides, which are also | ||
// dynamically reloaded. | ||
// I'm doing it the simple way for now. | ||
f.IntVar(&cfg.MaxTableOffset, prefix+".max-table-offset", 2, "Oldest day-table offset (from today, inclusive) to compact. This can be used to lower cost by not trying to compact older data which doesn't change. This can be optimized by aligning it with the maximum `reject_old_samples_max_age` setting of any tenant.") | ||
} | ||
|
||
func (cfg *Config) Validate() error { | ||
if cfg.MinTableOffset > cfg.MaxTableOffset { | ||
return fmt.Errorf("min-table-offset (%d) must be less than or equal to max-table-offset (%d)", cfg.MinTableOffset, cfg.MaxTableOffset) | ||
} | ||
|
||
return nil | ||
} | ||
|
||
type Limits interface { | ||
// TODO: Add limits | ||
BloomCreationEnabled(tenantID string) bool | ||
BloomSplitSeriesKeyspaceByFactor(tenantID string) int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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: IMO,
10m
is too frequent, it's more frequent than the TSDB index is compacted.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 changed it to 8 hours, so it runs three times a day. Wdyt