-
Notifications
You must be signed in to change notification settings - Fork 2.2k
compact: Add compactor time validation #7293
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: mluffman <[email protected]>
Signed-off-by: mluffman <[email protected]>
Signed-off-by: mluffman <[email protected]>
Signed-off-by: mluffman <[email protected]>
b5ed8c5 to
334c761
Compare
Signed-off-by: mluffman <[email protected]>
Signed-off-by: Nash Luffman <[email protected]>
| } | ||
|
|
||
| func validateFilterConf(filterConf *store.FilterConfig) error { | ||
| if filterConf.MinTime.PrometheusTimestamp() > filterConf.MaxTime.PrometheusTimestamp() { |
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 it valid to have them equal? If the compactor MinTime and MaxTime are equal it will just be non-functional iirc.
|
|
||
| cc.filterConf = &store.FilterConfig{} | ||
| cmd.Flag("min-time", "Start of time range limit to compact. Thanos Compactor will compact only blocks, which happened later than this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or 2h45m. Valid duration units are ms, s, m, h, d, w, y."). | ||
| cmd.Flag("min-time", "Start of time range limit to compact. Thanos Compactor will only compact blocks whose max time is at a date more recent than this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Durations must be negative, and valid units are ms, s, m, h, d, w, y."). |
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.
| cmd.Flag("min-time", "Start of time range limit to compact. Thanos Compactor will only compact blocks whose max time is at a date more recent than this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Durations must be negative, and valid units are ms, s, m, h, d, w, y."). | |
| cmd.Flag("min-time", "Start of time range limit to compact. Thanos Compactor will compact only blocks with a maximum time more recent than this specified value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Durations must be negative, and valid units are ms, s, m, h, d, w, y."). |
Whose is an unnatural possessive for an inanimate object (a block).
| cmd.Flag("min-time", "Start of time range limit to compact. Thanos Compactor will only compact blocks whose max time is at a date more recent than this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Durations must be negative, and valid units are ms, s, m, h, d, w, y."). | ||
| Default("0000-01-01T00:00:00Z").SetValue(&cc.filterConf.MinTime) | ||
| cmd.Flag("max-time", "End of time range limit to compact. Thanos Compactor will compact only blocks, which happened earlier than this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or 2h45m. Valid duration units are ms, s, m, h, d, w, y."). | ||
| cmd.Flag("max-time", "End of time range limit to compact. Thanos Compactor will only compact blocks whose min time is at a date less recent this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Valid units for duration are ms, s, m, h, d, w, y."). |
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.
| cmd.Flag("max-time", "End of time range limit to compact. Thanos Compactor will only compact blocks whose min time is at a date less recent this value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Valid units for duration are ms, s, m, h, d, w, y."). | |
| cmd.Flag("max-time", "End of time range limit to compact. Thanos Compactor will compact only blocks with a maximum time older than this specified value. Option can be a constant time in RFC3339 format or time duration relative to current time, such as -1d or -2h45m. Valid units for duration are ms, s, m, h, d, w, y."). |
Same as above, and I also believe it has to be older than max time, if it's older than min-time, block might be beyond this value and thus you'd actually be compacting max-time + block size (which could be up to multiple days/weeks)
Changes
Adds validation to
--min-timeand--max-timeflags. The documentation isn't super clear and caused me confusion, along with another report in this issueAs far as I'm able to reason about
--min-timedurations in the future are nonsensical and invalid, but future absolute times are valid.--min-timeshould never be a more recent date than--max-time.Verification
Invalid use cases caught by new validation
Future time for
--min-time--max-timegreater than--min-timeExisting, valid use cases still passing
No time ranges
Only
--min-timespecifiedFuture absolute time specified for
--min-time