-
Notifications
You must be signed in to change notification settings - Fork 859
Parquet: Skip parquet conversion for blocks with too many labels #7524
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
Open
siddarth2810
wants to merge
10
commits into
cortexproject:master
Choose a base branch
from
siddarth2810:add-no-convert-marker
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
d2d010a
Add parquet no-convert marker and read/write logic
siddarth2810 7d9ef9f
parquetconverter: skip blocks with too many label names
siddarth2810 df4b725
Update config docs for max-block-label-names
siddarth2810 185bae9
integration: Add test for parquet no-convert marker
siddarth2810 119074c
Update changelog with parquet-converter.max-block-label-names limit
siddarth2810 b7f083a
chore: Add //nolint:errcheck to fix lint errors and update Changelog …
siddarth2810 414ebec
fix: Add missing parquet_converter_max_block_label_names to exporter …
siddarth2810 0631431
Add skippedBlocks metric and change skip log to Debug
siddarth2810 e63715f
docs: Add max-block-label-names to experimental features list
siddarth2810 ebeecdc
chore(parquetconverter): increment skipped blocks metric when no-conv…
siddarth2810 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,142 @@ | ||
| //go:build integration | ||
|
|
||
| package integration | ||
|
|
||
| import ( | ||
| "context" | ||
| "fmt" | ||
| "math/rand" | ||
| "path/filepath" | ||
| "testing" | ||
| "time" | ||
|
|
||
| "github.com/prometheus/prometheus/model/labels" | ||
| "github.com/stretchr/testify/require" | ||
| "github.com/thanos-io/objstore" | ||
| "github.com/thanos-io/thanos/pkg/block" | ||
| "github.com/thanos-io/thanos/pkg/block/metadata" | ||
|
|
||
| "github.com/cortexproject/cortex/integration/e2e" | ||
| e2ecache "github.com/cortexproject/cortex/integration/e2e/cache" | ||
| e2edb "github.com/cortexproject/cortex/integration/e2e/db" | ||
| "github.com/cortexproject/cortex/integration/e2ecortex" | ||
| "github.com/cortexproject/cortex/pkg/storage/bucket" | ||
| "github.com/cortexproject/cortex/pkg/storage/tsdb" | ||
| "github.com/cortexproject/cortex/pkg/util/log" | ||
| cortex_testutil "github.com/cortexproject/cortex/pkg/util/test" | ||
| ) | ||
|
|
||
| func TestParquetConverter_NoConvertMarkWithTooManyLabels(t *testing.T) { | ||
| s, err := e2e.NewScenario(networkName) | ||
| require.NoError(t, err) | ||
| defer s.Close() | ||
|
|
||
| consul := e2edb.NewConsulWithName("consul") | ||
| memcached := e2ecache.NewMemcached() | ||
| require.NoError(t, s.StartAndWaitReady(consul, memcached)) | ||
|
|
||
| baseFlags := mergeFlags(AlertmanagerLocalFlags(), BlocksStorageFlags()) | ||
| flags := mergeFlags( | ||
| baseFlags, | ||
| map[string]string{ | ||
| "-target": "all,parquet-converter", | ||
| "-blocks-storage.tsdb.block-ranges-period": "1m,24h", | ||
| "-blocks-storage.tsdb.ship-interval": "1s", | ||
| "-blocks-storage.bucket-store.sync-interval": "1s", | ||
| "-blocks-storage.bucket-store.metadata-cache.bucket-index-content-ttl": "1s", | ||
| "-blocks-storage.bucket-store.bucket-index.idle-timeout": "1s", | ||
| "-blocks-storage.bucket-store.bucket-index.enabled": "true", | ||
| "-blocks-storage.bucket-store.index-cache.backend": tsdb.IndexCacheBackendInMemory, | ||
| // compactor | ||
| "-compactor.cleanup-interval": "1s", | ||
| // Ingester. | ||
| "-ring.store": "consul", | ||
| "-consul.hostname": consul.NetworkHTTPEndpoint(), | ||
| // Distributor. | ||
| "-distributor.replication-factor": "1", | ||
| // Store-gateway. | ||
| "-store-gateway.sharding-enabled": "false", | ||
| "--querier.store-gateway-addresses": "nonExistent", // Make sure we do not call Store gateways | ||
| // alert manager | ||
| "-alertmanager.web.external-url": "http://localhost/alertmanager", | ||
| // Enable vertical sharding. | ||
| "-frontend.query-vertical-shard-size": "3", | ||
| "-frontend.max-cache-freshness": "1m", | ||
| // enable experimental promQL funcs | ||
| "-querier.enable-promql-experimental-functions": "true", | ||
| // parquet-converter | ||
| "-parquet-converter.ring.consul.hostname": consul.NetworkHTTPEndpoint(), | ||
| "-parquet-converter.conversion-interval": "1s", | ||
| "-parquet-converter.enabled": "true", | ||
| "-parquet-converter.max-block-label-names": "1", | ||
| // Querier | ||
| "-querier.enable-parquet-queryable": "true", | ||
| // Enable cache for parquet labels and chunks | ||
| "-blocks-storage.bucket-store.parquet-labels-cache.backend": "inmemory,memcached", | ||
| "-blocks-storage.bucket-store.parquet-labels-cache.memcached.addresses": "dns+" + memcached.NetworkEndpoint(e2ecache.MemcachedPort), | ||
| "-blocks-storage.bucket-store.chunks-cache.backend": "inmemory,memcached", | ||
| "-blocks-storage.bucket-store.chunks-cache.memcached.addresses": "dns+" + memcached.NetworkEndpoint(e2ecache.MemcachedPort), | ||
| }, | ||
| ) | ||
|
|
||
| // make alert manager config dir | ||
| require.NoError(t, writeFileToSharedDir(s, "alertmanager_configs", []byte{})) | ||
|
|
||
| ctx := context.Background() | ||
| rnd := rand.New(rand.NewSource(time.Now().Unix())) | ||
| dir := filepath.Join(s.SharedDir(), "data") | ||
| lbls := []labels.Labels{ | ||
| labels.FromStrings("__name__", "test_series_a", "job", "test"), | ||
| } | ||
|
|
||
| numSamples := 60 | ||
| scrapeInterval := time.Minute | ||
| now := time.Now() | ||
| start := now.Add(-time.Hour * 24) | ||
| end := now.Add(-time.Hour) | ||
|
|
||
| minio := e2edb.NewMinio(9000, flags["-blocks-storage.s3.bucket-name"]) | ||
| require.NoError(t, s.StartAndWaitReady(minio)) | ||
|
|
||
| cortex := e2ecortex.NewSingleBinary("cortex", flags, "") | ||
| require.NoError(t, s.StartAndWaitReady(cortex)) | ||
| storage, err := e2ecortex.NewS3ClientForMinio(minio, flags["-blocks-storage.s3.bucket-name"]) | ||
| require.NoError(t, err) | ||
| bkt := bucket.NewUserBucketClient("user-1", storage.GetBucket(), nil) | ||
|
|
||
| id, err := e2e.CreateBlock(ctx, rnd, dir, lbls, numSamples, | ||
| start.UnixMilli(), | ||
| end.UnixMilli(), | ||
| scrapeInterval.Milliseconds(), 10, | ||
| ) | ||
| require.NoError(t, err) | ||
|
|
||
| err = block.Upload(ctx, log.Logger, bkt, filepath.Join(dir, id.String()), metadata.NoneFunc) | ||
| require.NoError(t, err) | ||
|
|
||
| // Wait for the converter to write the no-convert marker | ||
| cortex_testutil.Poll(t, 30*time.Second, true, func() interface{} { | ||
| noConvertMarkerPath := fmt.Sprintf("%s/parquet-no-convert-mark.json", id.String()) | ||
| found := false | ||
| err := bkt.Iter(ctx, "", func(name string) error { | ||
| if name == noConvertMarkerPath { | ||
| found = true | ||
| } | ||
| return nil | ||
| }, objstore.WithRecursiveIter()) | ||
| require.NoError(t, err) | ||
| return found | ||
| }) | ||
|
|
||
| // confirm the conversion did not happen (check both paths) | ||
| blockID := id.String() | ||
| markerPaths := []string{ | ||
| fmt.Sprintf("%s/parquet-converter-mark.json", blockID), | ||
| fmt.Sprintf("parquet-markers/%s-parquet-converter-mark.json", blockID), | ||
| } | ||
| for _, markerPath := range markerPaths { | ||
| exists, err := bkt.Exists(ctx, markerPath) | ||
| require.NoError(t, err) | ||
| require.False(t, exists, "converter mark should not exist at %s", markerPath) | ||
| } | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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.
Uh oh!
There was an error while loading. Please reload this page.