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

[WIP] compact: Add vertical-deduplication for replica-labels as MetaFetcher filter #2217

Conversation

metalmatze
Copy link
Contributor

@metalmatze metalmatze commented Mar 5, 2020

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

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.

compact_test.go:60: unexpected error: upload file /tmp/e2e_integration_test767365421/tmp/01E2NBJ5Q70000000000000000/chunks/000001 as 01E2NBJ5Q70000000000000000/chunks/000001: upload s3 object: Get "http://e2e_test_compact-minio-80/thanos/?location=": dial tcp: lookup e2e_test_compact-minio-80: no such host

/cc @brancz @bwplotka @squat

Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
Signed-off-by: Matthias Loibl <mail@matthiasloibl.com>
@metalmatze metalmatze force-pushed the offline-deduplication.replica-labels branch from ec2836a to e24a283 Compare March 5, 2020 13:22
@bwplotka bwplotka changed the title [WIP] compact: Add offline-deduplication for replica-labels as MetaFetcher filter [WIP] compact: Add vertical-deduplication for replica-labels as MetaFetcher filter Mar 10, 2020
Copy link
Member

@bwplotka bwplotka left a 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").
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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").

Copy link
Member

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()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Hidden().String()
Hidden().Strings()

Copy link
Member

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, ",")}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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, ",")}
Copy link
Member

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 {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
type ReplicaLabelsFilter struct {
type ReplicaLabelConstructingFakeMetaFilter struct {

;p

Copy link
Member

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

Copy link
Member

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()
Copy link
Member

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)
Copy link
Member

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")}
Copy link
Member

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

Copy link
Member

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))

Copy link
Member

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))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kill this

@kakkoyun
Copy link
Member

kakkoyun commented Mar 10, 2020

@bwplotka @squat As we have discussed offline, picking up from where @metalmatze left off in #2250.

@metalmatze metalmatze closed this Mar 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants