-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[WIP] compact: Add vertical-deduplication for replica-labels as MetaFetcher filter #2217
[WIP] compact: Add vertical-deduplication for replica-labels as MetaFetcher filter #2217
Conversation
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
ec2836a
to
e24a283
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.
Nice!
Super close, some comments we did together with @kakkoyun. He is happy to continue your PR.
@@ -121,6 +121,9 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) { | |||
compactionConcurrency := cmd.Flag("compact.concurrency", "Number of goroutines to use when compacting groups."). | |||
Default("1").Int() | |||
|
|||
dedupReplicaLabels := cmd.Flag("offline-deduplication.replica-labels", "Label to treat as a replica indicator of blocks that can be deduplicated. This will merge multiple replica blocks into one. This process is irrevertable. Experminteal"). |
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.
dedupReplicaLabels := cmd.Flag("offline-deduplication.replica-labels", "Label to treat as a replica indicator of blocks that can be deduplicated. This will merge multiple replica blocks into one. This process is irrevertable. Experminteal"). | |
dedupReplicaLabels := cmd.Flag("deduplication.replica-label", "Label to treat as a replica indicator of blocks that can be deduplicated. This will merge multiple replica blocks into one (repeated flag). This process is irreversible. Experimental"). |
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.
Let's make sure it's documented that it's ONLY vertical for now and what it means.
@@ -121,6 +121,9 @@ func registerCompact(m map[string]setupFunc, app *kingpin.Application) { | |||
compactionConcurrency := cmd.Flag("compact.concurrency", "Number of goroutines to use when compacting groups."). | |||
Default("1").Int() | |||
|
|||
dedupReplicaLabels := cmd.Flag("offline-deduplication.replica-labels", "Label to treat as a replica indicator of blocks that can be deduplicated. This will merge multiple replica blocks into one. This process is irrevertable. Experminteal"). | |||
Hidden().String() |
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.
Hidden().String() | |
Hidden().Strings() |
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.
Let's add comment to Hidden
why it's hidden
@@ -242,10 +247,13 @@ func runCompact( | |||
|
|||
duplicateBlocksFilter := block.NewDeduplicateFilter() | |||
prometheusRegisterer := extprom.WrapRegistererWithPrefix("thanos_", reg) | |||
replicaLabelFilter := block.ReplicaLabelsFilter{ReplicaLabels: strings.Split(dedupReplicaLabels, ",")} |
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.
replicaLabelFilter := block.ReplicaLabelsFilter{ReplicaLabels: strings.Split(dedupReplicaLabels, ",")} | |
replicaLabelFilter := block.ReplicaLabelFilter{ReplicaLabels: dedupReplicaLabels} |
@@ -242,10 +247,13 @@ func runCompact( | |||
|
|||
duplicateBlocksFilter := block.NewDeduplicateFilter() | |||
prometheusRegisterer := extprom.WrapRegistererWithPrefix("thanos_", reg) | |||
replicaLabelFilter := block.ReplicaLabelsFilter{ReplicaLabels: strings.Split(dedupReplicaLabels, ",")} |
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.
Can we inline this?
@@ -533,6 +534,23 @@ func contains(s1 []ulid.ULID, s2 []ulid.ULID) bool { | |||
return true | |||
} | |||
|
|||
type ReplicaLabelsFilter struct { |
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.
type ReplicaLabelsFilter struct { | |
type ReplicaLabelConstructingFakeMetaFilter struct { |
;p
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.
Actually as @kakkoyun found it's not a filter, so maybe different name
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.
"Modifier"?
@@ -242,10 +247,13 @@ func runCompact( | |||
|
|||
duplicateBlocksFilter := block.NewDeduplicateFilter() |
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.
Somewhere we need to enable vertical compaction flag IF replica flag is enabled on LeveledCompactor
dir := filepath.Join(s.SharedDir(), "tmp") | ||
|
||
now := time.Now() | ||
id1, err := e2eutil.CreateBlockWithBlockDelay(ctx, dir, series, 10, timestamp.FromTime(now), timestamp.FromTime(now.Add(2*time.Hour)), 30*time.Minute, extLset, 0) |
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 don''t need or want delay I think
Insecure: true, | ||
} | ||
|
||
series := []labels.Labels{labels.FromStrings("a", "1", "b", "2")} |
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.
Let's maybe put block creation to separate function, because we need to create tons of them for the tests
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.
Potentiall would be nice to have a table test for different tests
- Offline Dedup
- Vertical dedup (let's focus in this)
- Downs
- Compacti
- retention
etc
}) | ||
testutil.Ok(t, err) | ||
testutil.Ok(t, s.StartAndWaitReady(compact)) | ||
|
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.
On each run of table test, we need to create some blocks, then assert something.
Open question: In table test: Should we clean up the bucket or clean up + restart compactor.
return nil, errors.Wrapf(err, "generate compact config file: %v", bucketConfig) | ||
} | ||
|
||
fmt.Println(string(bktConfigBytes)) |
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.
Kill this
@bwplotka @squat As we have discussed offline, picking up from where @metalmatze left off in #2250. |
Need to create the PR first to get a number 😁
Changes
Add MetaFetcher filter called ReplicaLabelsFilter in: c6828f9
Other commits are to add e2e tests.
Verification
This is the reason why it's still WIP. I want to finish the end to end tests, but I get minio errors. I'm not able to fix it right now.
/cc @brancz @bwplotka @squat