allow specifying the hex width to use when generating shard ranges#723
Merged
allow specifying the hex width to use when generating shard ranges#723
Conversation
nickvanw
approved these changes
Sep 24, 2025
Contributor
nickvanw
left a comment
There was a problem hiding this comment.
LGTM pending one question about data validation
| hexWidth: | ||
| default: 0 | ||
| format: int32 | ||
| maximum: 65536 |
Contributor
There was a problem hiding this comment.
Is there a reasonable maximum for this that isn't int32 max?
Member
Author
There was a problem hiding this comment.
i have based it on the maximum size we support in vitess:
default:
return nil, errors.New("this function does not support more than 65536 shards in a single keyspace")
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
260c243 to
1698c81
Compare
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
fatih
reviewed
Sep 25, 2025
| // +kubebuilder:default=0 | ||
| // +kubebuilder:validation:Minimum=0 | ||
| // +kubebuilder:validation:Maximum=65536 | ||
| HexWidth int32 `json:"hexWidth"` |
Member
There was a problem hiding this comment.
Is this required? If not we should add an omitempty tag
Member
Author
There was a problem hiding this comment.
That's a good point. Adding the tag via 61201eb.
I think the kubebuilder default was preventing this to error given a default is always set, but with the omitempty tag the CRD/api looks cleaner
Signed-off-by: Florent Poinsard <florent.poinsard@outlook.fr>
arthurschreiber
approved these changes
Sep 25, 2025
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This ports vitessio/vitess#18633 to the vitess-operator.
This PR adds the field
hexWidthin the CRD, inVitessKeyspaceEqualPartitioning. With it, users can specify the width of their shard names. The default value is set by the kubebuilder to 0, which makes it a no-op and backward compatible for previous versions of Vitess or for people not using hex width.