Skip to content

Distributor default sharding should support default 0 value. #5759

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

Merged
merged 4 commits into from
Feb 2, 2024

Conversation

Kramer0x0
Copy link
Contributor

There is a discrepancy between the current behavior of the system and the documented functionality regarding the setting of the ingestion_tenant_shard_size parameter.
Current Behavior

When attempting to set the -distributor.ingestion-tenant-shard-size flag to 0, the system throws an error.
Expected Behavior (As Per Documentation)

The documentation states the following:

# 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]

According to this, setting the value to 0 should be supported and is intended to disable shuffle sharding for the tenant.
Rationale for Setting the Value to 0

The intention behind setting the ingestion_tenant_shard_size to 0 by default is to enable shuffle-sharding, while also allowing a tenant to utilize the entire ring as the shard size. This setup is crucial for overwriting settings for specific tenants who might require shuffle sharding. The issue was identified during an attempt to configure our ingesters with the zero value.

What this PR does:

This PR addresses the exception that is thrown, warns a customer when the combination of shuffle sharding enabled and ingestion_tenant_shard_size == 0. Also addressing the Push() function to check and update the ring topology accordingly.

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

Related: #5250

Checklist

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

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

if cfg.ShardingStrategy == util.ShardingStrategyShuffle && limits.IngestionTenantShardSize <= 0 {
if limits.IngestionTenantShardSize < 0 {
Copy link
Contributor

Choose a reason for hiding this comment

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

if cfg.ShardingStrategy == util.ShardingStrategyShuffle && limits.IngestionTenantShardSize < 0 {
}

I think it is fine to have IngestionTenantShardSize < 0 when strategy is not shuffle sharding as it is a noop.

@yeya24 yeya24 requested a review from danielblando February 1, 2024 03:23
@Kramer0x0 Kramer0x0 requested a review from yeya24 February 1, 2024 18:11
@@ -178,7 +178,7 @@ func (cfg *Config) Validate(limits validation.Limits) error {
return errInvalidShardingStrategy
}

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

Choose a reason for hiding this comment

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

nit: can you update the error message invalid tenant shard size, the value must be greater than 0

Copy link
Contributor

Choose a reason for hiding this comment

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

That's a good call.

Copy link
Contributor

@danielblando danielblando left a comment

Choose a reason for hiding this comment

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

Thanks

@yeya24 yeya24 merged commit 8b15216 into cortexproject:master Feb 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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