Skip to content
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

compact: Add compactor time validation #7293

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

Nashluffy
Copy link

@Nashluffy Nashluffy commented Apr 20, 2024

  • I added CHANGELOG entry for this change.
  • Change is not relevant to the end user.

Changes

Adds validation to --min-time and --max-time flags. The documentation isn't super clear and caused me confusion, along with another report in this issue

As far as I'm able to reason about

  • --min-time durations in the future are nonsensical and invalid, but future absolute times are valid.
  • --min-time should never be a more recent date than --max-time.

Verification

Invalid use cases caught by new validation

Future time for --min-time

mluffman:~/code/thanos$ /home/mluffman/go/bin/thanos compact --objstore.config-file=fs-conf.yaml --min-time=5d
ts=2024-04-20T12:47:41.589010523Z caller=factory.go:53 level=info msg="loading bucket configuration"
ts=2024-04-20T12:47:41.589226572Z caller=main.go:135 level=error err="invalid time filters: min time: duration cannot be in the future\npreparing compact command failed\nmain.main\n\t/home/mluffman/code/thanos/cmd/thanos/main.go:135\nruntime.main\n\t/opt/tm/tools/go/1.22.2-20240403/usr/go/src/runtime/proc.go:271\nruntime.goexit\n\t/opt/tm/tools/go/1.22.2-20240403/usr/go/src/runtime/asm_amd64.s:1695"

--max-time greater than --min-time

mluffman:~/code/thanos$ /home/mluffman/go/bin/thanos compact --objstore.config-file=fs-conf.yaml --max-time=-12h --min-time=-4h
ts=2024-04-20T12:48:44.929847137Z caller=factory.go:53 level=info msg="loading bucket configuration"
ts=2024-04-20T12:48:44.930003855Z caller=main.go:135 level=error err="invalid time filters: max time must be a time or duration after min time\npreparing compact command failed\nmain.main\n\t/home/mluffman/code/thanos/cmd/thanos/main.go:135\nruntime.main\n\t/opt/tm/tools/go/1.22.2-20240403/usr/go/src/runtime/proc.go:271\nruntime.goexit\n\t/opt/tm/tools/go/1.22.2-20240403/usr/go/src/runtime/asm_amd64.s:1695"

Existing, valid use cases still passing

No time ranges

mluffman:~/code/thanos$ /home/mluffman/go/bin/thanos compact --objstore.config-file=fs-conf.yaml
ts=2024-04-20T12:49:38.138409312Z caller=factory.go:53 level=info msg="loading bucket configuration"
ts=2024-04-20T12:49:38.138809502Z caller=compact.go:683 level=info msg="starting compact node"

Only --min-time specified

mluffman:~/code/thanos$ /home/mluffman/go/bin/thanos compact --objstore.config-file=fs-conf.yaml --min-time=-4h
ts=2024-04-20T12:49:51.839429392Z caller=factory.go:53 level=info msg="loading bucket configuration"
ts=2024-04-20T12:49:51.8400529Z caller=compact.go:683 level=info msg="starting compact node"

Future absolute time specified for --min-time

mluffman:~/code/thanos$ /home/mluffman/go/bin/thanos compact --objstore.config-file=fs-conf.yaml --min-time=2025-01-01T00:00:00Z
ts=2024-04-20T12:51:46.522495074Z caller=factory.go:53 level=info msg="loading bucket configuration"
ts=2024-04-20T12:51:46.522700514Z caller=compact.go:683 level=info msg="starting compact node"

mluffman added 4 commits April 20, 2024 14:19
Signed-off-by: mluffman <nashluffman@gmail.com>
Signed-off-by: mluffman <nashluffman@gmail.com>
Signed-off-by: mluffman <nashluffman@gmail.com>
Signed-off-by: mluffman <nashluffman@gmail.com>
@Nashluffy Nashluffy force-pushed the add-compactor-time-validation branch from b5ed8c5 to 334c761 Compare April 20, 2024 13:20
Signed-off-by: mluffman <nashluffman@gmail.com>
Signed-off-by: Nash Luffman <nashluffman@gmail.com>
@Nashluffy Nashluffy changed the title Add compactor time validation compact: Add compactor time validation Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants