You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
returnnil, errors.New("shards must be greater than zero")
caseshards<=256:
format="%02x"
maxShards=256
caseshards<=65536:
format="%04x"
maxShards=65536
default:
returnnil, errors.New("this function does not support more than 65336 shards in a single keyspace")
}
Add a new parameter to this method, or a new method, that allows users to configure the # of digits in a shard range.
If this FR is accepted, a follow-up FR will be to plumb this configurability in to planetscale/vitess-operator
Use Case(s)
When using non-power-of-2 # of shards, there is a degree of "lossiness" where the last shard is larger than it should be, and the rest are smaller than they should be.
maxenglander
changed the title
Feature Request: configurable granularity of generated shard ranges
Feature Request: configurable number of digits in generated shard ranges
Apr 17, 2024
Feature Description
key.GenerateShardRanges
uses 2 hex digits in shard ranges when there are 256 or fewer shards.vitess/go/vt/key/key.go
Lines 369 to 384 in f11de06
Add a new parameter to this method, or a new method, that allows users to configure the # of digits in a shard range.
If this FR is accepted, a follow-up FR will be to plumb this configurability in to planetscale/vitess-operator
Use Case(s)
When using non-power-of-2 # of shards, there is a degree of "lossiness" where the last shard is larger than it should be, and the rest are smaller than they should be.
vitess/go/vt/key/key.go
Lines 406 to 420 in f11de06
By allowing users to configure the # of hex digits in their shard ranges, they can configure the degree of lossiness.
For example, generating a 5-shard cluster with 2-digit shard ranges results in:
-33 33-66 66-99 99-cc cc-
.If we increase the shard digits for the same 5-shard cluster, we end up with:
-3333 3333-6666 6666-9999 9999-cccc cccc-
, which is less lossy.The text was updated successfully, but these errors were encountered: