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

Distributor validation #5250

Closed

Conversation

dogukanteber
Copy link
Contributor

What this PR does:
According to the docs, shuffle sharding should be disabled when -distributor.ingestion-tenant-shard-size is set to 0:

# The default tenant's shard size when the shuffle-sharding strategy is used.
# Must be set both on ingesters and distributors. When this setting is specified
# in the per-tenant overrides, a value of 0 disables shuffle sharding for the
# tenant.
# CLI flag: -distributor.ingestion-tenant-shard-size
[ingestion_tenant_shard_size: <int> | default = 0]

However, doing that returns an error. This PR adjusts the code to what the docs say.

Which issue(s) this PR fixes:
Fixes #5189

Checklist

  • Tests updated
  • Documentation added
  • CHANGELOG.md updated - the order of entries should be [CHANGE], [FEATURE], [ENHANCEMENT], [BUGFIX]

Signed-off-by: Doğukan Teber <dogukanteber1@hotmail.com>
Signed-off-by: Doğukan Teber <dogukanteber1@hotmail.com>
Signed-off-by: Doğukan Teber <dogukanteber1@hotmail.com>
@@ -175,8 +174,10 @@ func (cfg *Config) Validate(limits validation.Limits) error {
return errInvalidShardingStrategy
}

if cfg.ShardingStrategy == util.ShardingStrategyShuffle && limits.IngestionTenantShardSize <= 0 {
return errInvalidTenantShardSize
if limits.IngestionTenantShardSize <= 0 {
Copy link
Member

@friedrichg friedrichg Apr 6, 2023

Choose a reason for hiding this comment

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

There could be an scenario where:

  1. Shuffle sharding is enabled for all tenants
  2. Ingestion tenant shard is zero for all tenants
  3. There is one specific tenant that has tenant shard bigger than zero
    IngestionTenantShardSize int `yaml:"ingestion_tenant_shard_size" json:"ingestion_tenant_shard_size"`
  4. Shuffle sharding should be definitely enabled for that tenant.

Is that supported with this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I guess it does not. Let me check and make necessary changes

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 is still supported

Copy link
Contributor Author

@dogukanteber dogukanteber May 30, 2023

Choose a reason for hiding this comment

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

I checked the case you mentioned @friedrichg and made sure it is still supported with this change.

Copy link
Member

Choose a reason for hiding this comment

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

We make sure things are supported adding tests. integration or unit test

@sanyamjain22
Copy link

sanyamjain22 commented Apr 18, 2023

i think changing the validation to not throw error when shard size is specified to zero should be fine. Ring package takes care of the cases when shard size specified is <=0 or greater than number of instances. It returns the whole ring in such cases, which is desired in this case

Signed-off-by: Doğukan Teber <dogukanteber1@hotmail.com>
Signed-off-by: Doğukan Teber <dogukanteber1@hotmail.com>
@@ -15,11 +15,11 @@
* [ENHANCEMENT] Log: Avoid expensive log.Valuer evaluation for disallowed levels. #5297
* [ENHANCEMENT] Improving Performance on the API Gzip Handler. #5347
* [BUGFIX] Ruler: Validate if rule group can be safely converted back to rule group yaml from protobuf message #5265
* [BUGFIX] Querier: Convert gRPC `ResourceExhausted` status code from store gateway to 422 limit error. #5286
Copy link
Member

Choose a reason for hiding this comment

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

we need a separate PR for this. don't fix stuff that is not related to the PR

@@ -175,8 +174,10 @@ func (cfg *Config) Validate(limits validation.Limits) error {
return errInvalidShardingStrategy
}

if cfg.ShardingStrategy == util.ShardingStrategyShuffle && limits.IngestionTenantShardSize <= 0 {
return errInvalidTenantShardSize
if limits.IngestionTenantShardSize <= 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 make sure things are supported adding tests. integration or unit test

@stale
Copy link

stale bot commented Sep 17, 2023

This issue has been automatically marked as stale because it has not had any activity in the past 60 days. It will be closed in 15 days if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Sep 17, 2023
@friedrichg friedrichg added the keepalive Skipped by stale bot label Dec 11, 2023
@stale stale bot removed the stale label Dec 11, 2023
@dogukanteber dogukanteber deleted the distributor-validation branch February 5, 2024 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
keepalive Skipped by stale bot size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

setting -distributor.ingestion-tenant-shard-size to 0 throws error
3 participants