From 54ce07d239f50caf5d01ab84c503c1a0ff75e91c Mon Sep 17 00:00:00 2001 From: yoheimuta Date: Tue, 13 Jun 2023 19:54:44 +0900 Subject: [PATCH 1/4] feat: Allow more than one VitessShardTabletPool with a certain tablet type in a given cell Signed-off-by: yoheimuta --- .../crds/planetscale.com_vitessclusters.yaml | 12 +++++++ .../crds/planetscale.com_vitesskeyspaces.yaml | 12 +++++++ deploy/crds/planetscale.com_vitessshards.yaml | 6 ++++ docs/api/index.html | 16 ++++++++- pkg/apis/planetscale/v2/labels.go | 2 ++ .../planetscale/v2/vitessshard_methods.go | 4 +-- pkg/apis/planetscale/v2/vitessshard_types.go | 11 +++++- pkg/controller/vitessshard/reconcile_disk.go | 5 +++ .../vitessshard/reconcile_tablets.go | 6 ++++ pkg/operator/vttablet/uid.go | 21 +++++++++++- pkg/operator/vttablet/uid_test.go | 18 ++++++++++ .../vitesscluster/vitesscluster_test.go | 34 ++++++++++++++----- 12 files changed, 134 insertions(+), 13 deletions(-) diff --git a/deploy/crds/planetscale.com_vitessclusters.yaml b/deploy/crds/planetscale.com_vitessclusters.yaml index e1da903a..408d22a4 100644 --- a/deploy/crds/planetscale.com_vitessclusters.yaml +++ b/deploy/crds/planetscale.com_vitessclusters.yaml @@ -1461,6 +1461,11 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true + index: + default: 0 + format: int32 + minimum: 0 + type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -1571,6 +1576,7 @@ spec: x-kubernetes-list-map-keys: - type - cell + - index x-kubernetes-list-type: map required: - databaseInitScriptSecret @@ -1856,6 +1862,11 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true + index: + default: 0 + format: int32 + minimum: 0 + type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -1966,6 +1977,7 @@ spec: x-kubernetes-list-map-keys: - type - cell + - index x-kubernetes-list-type: map required: - databaseInitScriptSecret diff --git a/deploy/crds/planetscale.com_vitesskeyspaces.yaml b/deploy/crds/planetscale.com_vitesskeyspaces.yaml index c6b65933..41bfc180 100644 --- a/deploy/crds/planetscale.com_vitesskeyspaces.yaml +++ b/deploy/crds/planetscale.com_vitesskeyspaces.yaml @@ -509,6 +509,11 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true + index: + default: 0 + format: int32 + minimum: 0 + type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -619,6 +624,7 @@ spec: x-kubernetes-list-map-keys: - type - cell + - index x-kubernetes-list-type: map required: - databaseInitScriptSecret @@ -904,6 +910,11 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true + index: + default: 0 + format: int32 + minimum: 0 + type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -1014,6 +1025,7 @@ spec: x-kubernetes-list-map-keys: - type - cell + - index x-kubernetes-list-type: map required: - databaseInitScriptSecret diff --git a/deploy/crds/planetscale.com_vitessshards.yaml b/deploy/crds/planetscale.com_vitessshards.yaml index c1ed3f9c..7dc99925 100644 --- a/deploy/crds/planetscale.com_vitessshards.yaml +++ b/deploy/crds/planetscale.com_vitessshards.yaml @@ -492,6 +492,11 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true + index: + default: 0 + format: int32 + minimum: 0 + type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -602,6 +607,7 @@ spec: x-kubernetes-list-map-keys: - type - cell + - index x-kubernetes-list-type: map topologyReconciliation: properties: diff --git a/docs/api/index.html b/docs/api/index.html index 6cce83f3..bd480b47 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -7066,6 +7066,20 @@

VitessShardTabletPool +index
+ +int32 + + + +

Index is the pool’s index within the (cell,type) pair. +This field is optional, and defaults to 0. +Assigning different numbers to this field enables the existence of multiple pools with a specific tablet type in a given cell, +which can be beneficial for unmanaged tablets.

+ + + + replicas
int32 @@ -7329,7 +7343,7 @@

VitessShardTemplate

TabletPools specify groups of tablets in a given cell with a certain tablet type and a shared configuration template.

-

There must be at most one pool in this list for each (cell,type) pair. +

There must be at most one pool in this list for each (cell,type,index) set. Each shard must have at least one “replica” pool (in at least one cell) in order to be able to serve.

diff --git a/pkg/apis/planetscale/v2/labels.go b/pkg/apis/planetscale/v2/labels.go index 869147a0..88655180 100644 --- a/pkg/apis/planetscale/v2/labels.go +++ b/pkg/apis/planetscale/v2/labels.go @@ -35,6 +35,8 @@ const ( TabletUidLabel = LabelPrefix + "/" + "tablet-uid" // TabletTypeLabel is the key for identifying the Vitess target tablet type for a Pod. TabletTypeLabel = LabelPrefix + "/" + "tablet-type" + // TabletTypeLabel is the key for identifying the Vitess target pool index within the (cell,type) pair. + TabletPoolIndexLabel = LabelPrefix + "/" + "pool-index" // TabletIndexLabel is the key for identifying the index of a Vitess tablet within its pool. TabletIndexLabel = LabelPrefix + "/" + "tablet-index" diff --git a/pkg/apis/planetscale/v2/vitessshard_methods.go b/pkg/apis/planetscale/v2/vitessshard_methods.go index 35339544..6605c8c8 100644 --- a/pkg/apis/planetscale/v2/vitessshard_methods.go +++ b/pkg/apis/planetscale/v2/vitessshard_methods.go @@ -58,9 +58,9 @@ func (t *VitessTabletPoolType) InitTabletType() string { } } -// IsMatch indicates whether a tablet pool matches another tablet pool's type and cell. +// IsMatch indicates whether a tablet pool matches another tablet pool's type, cell and index. func (t *VitessShardTabletPool) IsMatch(inputPool *VitessShardTabletPool) bool { - return t.Type == inputPool.Type && t.Cell == inputPool.Cell + return t.Type == inputPool.Type && t.Cell == inputPool.Cell && t.Index == inputPool.Index } // UsingExternalDatastore indicates whether the VitessShard Spec is using diff --git a/pkg/apis/planetscale/v2/vitessshard_types.go b/pkg/apis/planetscale/v2/vitessshard_types.go index 2f739d94..e8b0efd0 100644 --- a/pkg/apis/planetscale/v2/vitessshard_types.go +++ b/pkg/apis/planetscale/v2/vitessshard_types.go @@ -105,7 +105,7 @@ type VitessShardTemplate struct { // TabletPools specify groups of tablets in a given cell with a certain // tablet type and a shared configuration template. // - // There must be at most one pool in this list for each (cell,type) pair. + // There must be at most one pool in this list for each (cell,type,index) set. // Each shard must have at least one "replica" pool (in at least one cell) // in order to be able to serve. // +patchMergeKey=type @@ -113,6 +113,7 @@ type VitessShardTemplate struct { // +listType=map // +listMapKey=type // +listMapKey=cell + // +listMapKey=index TabletPools []VitessShardTabletPool `json:"tabletPools,omitempty" patchStrategy:"merge" patchMergeKey:"type"` // DatabaseInitScriptSecret specifies the init_db.sql script file to use for this shard. @@ -170,6 +171,14 @@ type VitessShardTabletPool struct { // +kubebuilder:validation:Enum=replica;rdonly;externalmaster;externalreplica;externalrdonly Type VitessTabletPoolType `json:"type"` + // Index is the pool's index within the (cell,type) pair. + // This field is optional, and defaults to 0. + // Assigning different numbers to this field enables the existence of multiple pools with a specific tablet type in a given cell, + // which can be beneficial for unmanaged tablets. + // +kubebuilder:default=0 + // +kubebuilder:validation:Minimum=0 + Index int32 `json:"index,omitempty"` + // Replicas is the number of tablets to deploy in this pool. // This field is required, although it may be set to 0, // which will scale the pool down to 0 tablets. diff --git a/pkg/controller/vitessshard/reconcile_disk.go b/pkg/controller/vitessshard/reconcile_disk.go index 3a5c1275..7d95790c 100644 --- a/pkg/controller/vitessshard/reconcile_disk.go +++ b/pkg/controller/vitessshard/reconcile_disk.go @@ -53,6 +53,9 @@ func (r *ReconcileVitessShard) reconcileDisk(ctx context.Context, vts *planetsca continue } + // In cases where there are multiple pools with the same tablet type in a given cell, + // there is a possibility of processing the same tablet multiple times. + // We permit this to occur as it is practically harmless and simplifies implementation. poolTablets, err := tabletKeysForPool(vts, tabletPool.Cell, tabletPool.Type) if err != nil { return resultBuilder.Error(err) @@ -129,6 +132,8 @@ func (r *ReconcileVitessShard) claimForTabletPod(ctx context.Context, pod *v1.Po return pvc, nil } +// tabletKeysForPool returns the list of targetKeys for a given pool type and cell. +// Note that this function does not care about the pool's index assignment. func tabletKeysForPool(vts *planetscalev2.VitessShard, poolCell string, poolType planetscalev2.VitessTabletPoolType) ([]string, error) { tabletKeys := vts.Status.TabletAliases() diff --git a/pkg/controller/vitessshard/reconcile_tablets.go b/pkg/controller/vitessshard/reconcile_tablets.go index 762e6512..d995fec1 100644 --- a/pkg/controller/vitessshard/reconcile_tablets.go +++ b/pkg/controller/vitessshard/reconcile_tablets.go @@ -284,6 +284,11 @@ func vttabletSpecs(vts *planetscalev2.VitessShard, parentLabels map[string]strin Uid: vttablet.UID(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex)), } + // If TabletPools has multiple pools within the same (cell,type) pair, we need to add a pool index to the UID generator. + if 0 < pool.Index { + tabletAlias.Uid = vttablet.UIDWithPoolIndex(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex), uint32(pool.Index)) + } + // Copy parent labels map and add tablet-specific labels. labels := make(map[string]string, len(parentLabels)+4) for k, v := range parentLabels { @@ -292,6 +297,7 @@ func vttabletSpecs(vts *planetscalev2.VitessShard, parentLabels map[string]strin labels[planetscalev2.CellLabel] = tabletAlias.Cell labels[planetscalev2.TabletUidLabel] = strconv.FormatUint(uint64(tabletAlias.Uid), 10) labels[planetscalev2.TabletTypeLabel] = string(pool.Type) + labels[planetscalev2.TabletPoolIndexLabel] = strconv.FormatUint(uint64(pool.Index), 10) labels[planetscalev2.TabletIndexLabel] = strconv.FormatUint(uint64(tabletIndex), 10) // Merge ExtraVitessFlags into the tablet spec ExtraFlags field. diff --git a/pkg/operator/vttablet/uid.go b/pkg/operator/vttablet/uid.go index a768c8dd..690a38e1 100644 --- a/pkg/operator/vttablet/uid.go +++ b/pkg/operator/vttablet/uid.go @@ -43,7 +43,8 @@ lead time to develop a smarter way to handle tablet identity and MySQL server IDs in Vitess itself. WARNING: DO NOT change the behavior of this function, as that may result in - the deletion and recreation of all tablets. + + the deletion and recreation of all tablets. */ func UID(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRange, tabletPoolType planetscalev2.VitessTabletPoolType, tabletIndex uint32) uint32 { h := md5.New() @@ -51,3 +52,21 @@ func UID(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRan sum := h.Sum(nil) return binary.BigEndian.Uint32(sum[:4]) } + +/* +UIDWithPoolIndex function generates a 32-bit unsigned integer similar to the UID function above. + +However, it additionally takes the poolIndex as an input. +This allows the generation of a unique UID for a tablet that belongs to a different pool +but shares other common attributes. + +To preserve the existing UID, it is recommended to use the UID function instead of this function +when the poolIndex is set to its default value of 0. +*/ +func UIDWithPoolIndex(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRange, + tabletPoolType planetscalev2.VitessTabletPoolType, tabletIndex uint32, poolIndex uint32) uint32 { + h := md5.New() + fmt.Fprintln(h, cellName, keyspaceName, shardKeyRange.String(), string(tabletPoolType), tabletIndex, poolIndex) + sum := h.Sum(nil) + return binary.BigEndian.Uint32(sum[:4]) +} diff --git a/pkg/operator/vttablet/uid_test.go b/pkg/operator/vttablet/uid_test.go index 4a0765df..e3e88938 100644 --- a/pkg/operator/vttablet/uid_test.go +++ b/pkg/operator/vttablet/uid_test.go @@ -38,3 +38,21 @@ func TestUIDHash(t *testing.T) { t.Fatalf("UID() = %v, want %v", got, want) } } + +// TestUIDWithPoolIndexHash checks that nobody changed the hash function for UIDWithPoolIndex(). +func TestUIDWithPoolIndexHash(t *testing.T) { + cell := "cell" + keyspace := "keyspace" + keyRange := planetscalev2.VitessKeyRange{Start: "10", End: "20"} + tabletType := planetscalev2.ReplicaPoolType + tabletIndex := uint32(1) + poolIndex := uint32(1) + + // DO NOT CHANGE THIS VALUE! + // This is intentionally a change-detection test. If it breaks, you messed up. + want := uint32(3840445776) + + if got := UIDWithPoolIndex(cell, keyspace, keyRange, tabletType, tabletIndex, poolIndex); got != want { + t.Fatalf("UIDWithPoolIndex() = %v, want %v", got, want) + } +} diff --git a/test/integration/vitesscluster/vitesscluster_test.go b/test/integration/vitesscluster/vitesscluster_test.go index ac59b19a..abc0dc20 100644 --- a/test/integration/vitesscluster/vitesscluster_test.go +++ b/test/integration/vitesscluster/vitesscluster_test.go @@ -66,6 +66,16 @@ spec: resources: requests: storage: 1Gi + - cell: cell2 + type: rdonly + index: 1 + replicas: 3 + mysqld: {} + dataVolumeClaimTemplate: + accessModes: [ReadWriteOnce] + resources: + requests: + storage: 1Gi - equal: parts: 1 shardTemplate: @@ -181,9 +191,9 @@ func verifyBasicVitessKeyspace(f *framework.Fixture, ns, cluster, keyspace strin f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace), &planetscalev2.VitessKeyspace{}) // VitessKeyspaces create VitessShards. - verifyBasicVitessShard(f, ns, cluster, keyspace, "x-80", []int{3, 3, 0}) - verifyBasicVitessShard(f, ns, cluster, keyspace, "80-x", []int{3, 3, 0}) - verifyBasicVitessShard(f, ns, cluster, keyspace, "x-x", []int{0, 0, 3}) + verifyBasicVitessShard(f, ns, cluster, keyspace, "x-80", []int{3, 3, 3, 0}) + verifyBasicVitessShard(f, ns, cluster, keyspace, "80-x", []int{3, 3, 3, 0}) + verifyBasicVitessShard(f, ns, cluster, keyspace, "x-x", []int{0, 0, 0, 3}) } func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard string, expectedTabletCount []int) { @@ -192,16 +202,20 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s // VitessShard creates vttablet Pods. cell1Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell1", "replica"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell1", "replica", "0"), }, expectedTabletCount[0]) cell2Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", "0"), }, expectedTabletCount[1]) - cell3Pods := f.ExpectPods(&client.ListOptions{ + cell2_1_Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell3", "replica"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", "1"), }, expectedTabletCount[2]) + cell3Pods := f.ExpectPods(&client.ListOptions{ + Namespace: ns, + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell3", "replica", "0"), + }, expectedTabletCount[3]) // Each vttablet Pod should have a PVC. for i := range cell1Pods.Items { @@ -210,6 +224,9 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s for i := range cell2Pods.Items { f.MustGet(ns, cell2Pods.Items[i].Name, &corev1.PersistentVolumeClaim{}) } + for i := range cell2_1_Pods.Items { + f.MustGet(ns, cell2_1_Pods.Items[i].Name, &corev1.PersistentVolumeClaim{}) + } for i := range cell3Pods.Items { f.MustGet(ns, cell3Pods.Items[i].Name, &corev1.PersistentVolumeClaim{}) } @@ -219,7 +236,7 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace, shard, "vtbackup", "init"), &corev1.PersistentVolumeClaim{}) } -func tabletPodSelector(cluster, keyspace, shard, cell, tabletType string) apilabels.Selector { +func tabletPodSelector(cluster, keyspace, shard, cell, tabletType, poolIndex string) apilabels.Selector { // This intentionally does NOT use any shared constants because we want the // test to fail if the labels change, since that's a breaking change. return apilabels.Set{ @@ -228,5 +245,6 @@ func tabletPodSelector(cluster, keyspace, shard, cell, tabletType string) apilab "planetscale.com/shard": shard, "planetscale.com/cell": cell, "planetscale.com/tablet-type": tabletType, + "planetscale.com/pool-index": poolIndex, }.AsSelector() } From a042c49f75c53a2d2d54b975a9a43b59a64d21ce Mon Sep 17 00:00:00 2001 From: Yohei Yoshimuta Date: Tue, 20 Jun 2023 20:35:30 +0900 Subject: [PATCH 2/4] refactor: Rename the field called index to name in VitessShardTabletPool Signed-off-by: Yohei Yoshimuta --- .../crds/planetscale.com_vitessclusters.yaml | 20 ++++++++----------- .../crds/planetscale.com_vitesskeyspaces.yaml | 20 ++++++++----------- deploy/crds/planetscale.com_vitessshards.yaml | 10 ++++------ docs/api/index.html | 12 +++++------ pkg/apis/planetscale/v2/labels.go | 4 ++-- .../planetscale/v2/vitessshard_methods.go | 4 ++-- pkg/apis/planetscale/v2/vitessshard_types.go | 15 +++++++------- pkg/controller/vitessshard/reconcile_disk.go | 2 +- .../vitessshard/reconcile_tablets.go | 8 ++++---- pkg/operator/vttablet/uid.go | 12 +++++------ pkg/operator/vttablet/uid_test.go | 14 ++++++------- .../vitesscluster/vitesscluster_test.go | 14 ++++++------- 12 files changed, 62 insertions(+), 73 deletions(-) diff --git a/deploy/crds/planetscale.com_vitessclusters.yaml b/deploy/crds/planetscale.com_vitessclusters.yaml index 408d22a4..3d6e2ff1 100644 --- a/deploy/crds/planetscale.com_vitessclusters.yaml +++ b/deploy/crds/planetscale.com_vitessclusters.yaml @@ -1461,11 +1461,6 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true - index: - default: 0 - format: int32 - minimum: 0 - type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -1506,6 +1501,9 @@ spec: required: - resources type: object + name: + default: "" + type: string replicas: format: int32 minimum: 0 @@ -1576,7 +1574,7 @@ spec: x-kubernetes-list-map-keys: - type - cell - - index + - name x-kubernetes-list-type: map required: - databaseInitScriptSecret @@ -1862,11 +1860,6 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true - index: - default: 0 - format: int32 - minimum: 0 - type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -1907,6 +1900,9 @@ spec: required: - resources type: object + name: + default: "" + type: string replicas: format: int32 minimum: 0 @@ -1977,7 +1973,7 @@ spec: x-kubernetes-list-map-keys: - type - cell - - index + - name x-kubernetes-list-type: map required: - databaseInitScriptSecret diff --git a/deploy/crds/planetscale.com_vitesskeyspaces.yaml b/deploy/crds/planetscale.com_vitesskeyspaces.yaml index 41bfc180..9f267325 100644 --- a/deploy/crds/planetscale.com_vitesskeyspaces.yaml +++ b/deploy/crds/planetscale.com_vitesskeyspaces.yaml @@ -509,11 +509,6 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true - index: - default: 0 - format: int32 - minimum: 0 - type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -554,6 +549,9 @@ spec: required: - resources type: object + name: + default: "" + type: string replicas: format: int32 minimum: 0 @@ -624,7 +622,7 @@ spec: x-kubernetes-list-map-keys: - type - cell - - index + - name x-kubernetes-list-type: map required: - databaseInitScriptSecret @@ -910,11 +908,6 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true - index: - default: 0 - format: int32 - minimum: 0 - type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -955,6 +948,9 @@ spec: required: - resources type: object + name: + default: "" + type: string replicas: format: int32 minimum: 0 @@ -1025,7 +1021,7 @@ spec: x-kubernetes-list-map-keys: - type - cell - - index + - name x-kubernetes-list-type: map required: - databaseInitScriptSecret diff --git a/deploy/crds/planetscale.com_vitessshards.yaml b/deploy/crds/planetscale.com_vitessshards.yaml index 7dc99925..4eb7fc4f 100644 --- a/deploy/crds/planetscale.com_vitessshards.yaml +++ b/deploy/crds/planetscale.com_vitessshards.yaml @@ -492,11 +492,6 @@ spec: type: array extraVolumes: x-kubernetes-preserve-unknown-fields: true - index: - default: 0 - format: int32 - minimum: 0 - type: integer initContainers: x-kubernetes-preserve-unknown-fields: true mysqld: @@ -537,6 +532,9 @@ spec: required: - resources type: object + name: + default: "" + type: string replicas: format: int32 minimum: 0 @@ -607,7 +605,7 @@ spec: x-kubernetes-list-map-keys: - type - cell - - index + - name x-kubernetes-list-type: map topologyReconciliation: properties: diff --git a/docs/api/index.html b/docs/api/index.html index bd480b47..dfeb3cff 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -7066,15 +7066,15 @@

VitessShardTabletPool -index
+name
-int32 +string -

Index is the pool’s index within the (cell,type) pair. -This field is optional, and defaults to 0. -Assigning different numbers to this field enables the existence of multiple pools with a specific tablet type in a given cell, +

Name is the pool’s unique name within the (cell,type) pair. +This field is optional, and defaults to an empty. +Assigning different names to this field enables the existence of multiple pools with a specific tablet type in a given cell, which can be beneficial for unmanaged tablets.

@@ -7343,7 +7343,7 @@

VitessShardTemplate

TabletPools specify groups of tablets in a given cell with a certain tablet type and a shared configuration template.

-

There must be at most one pool in this list for each (cell,type,index) set. +

There must be at most one pool in this list for each (cell,type,name) set. Each shard must have at least one “replica” pool (in at least one cell) in order to be able to serve.

diff --git a/pkg/apis/planetscale/v2/labels.go b/pkg/apis/planetscale/v2/labels.go index 88655180..80b8d28b 100644 --- a/pkg/apis/planetscale/v2/labels.go +++ b/pkg/apis/planetscale/v2/labels.go @@ -35,8 +35,8 @@ const ( TabletUidLabel = LabelPrefix + "/" + "tablet-uid" // TabletTypeLabel is the key for identifying the Vitess target tablet type for a Pod. TabletTypeLabel = LabelPrefix + "/" + "tablet-type" - // TabletTypeLabel is the key for identifying the Vitess target pool index within the (cell,type) pair. - TabletPoolIndexLabel = LabelPrefix + "/" + "pool-index" + // TabletPoolNameLabel is the key for identifying the Vitess target pool name within the (cell,type) pair. + TabletPoolNameLabel = LabelPrefix + "/" + "pool-name" // TabletIndexLabel is the key for identifying the index of a Vitess tablet within its pool. TabletIndexLabel = LabelPrefix + "/" + "tablet-index" diff --git a/pkg/apis/planetscale/v2/vitessshard_methods.go b/pkg/apis/planetscale/v2/vitessshard_methods.go index 6605c8c8..2568bac6 100644 --- a/pkg/apis/planetscale/v2/vitessshard_methods.go +++ b/pkg/apis/planetscale/v2/vitessshard_methods.go @@ -58,9 +58,9 @@ func (t *VitessTabletPoolType) InitTabletType() string { } } -// IsMatch indicates whether a tablet pool matches another tablet pool's type, cell and index. +// IsMatch indicates whether a tablet pool matches another tablet pool's type, cell and name. func (t *VitessShardTabletPool) IsMatch(inputPool *VitessShardTabletPool) bool { - return t.Type == inputPool.Type && t.Cell == inputPool.Cell && t.Index == inputPool.Index + return t.Type == inputPool.Type && t.Cell == inputPool.Cell && t.Name == inputPool.Name } // UsingExternalDatastore indicates whether the VitessShard Spec is using diff --git a/pkg/apis/planetscale/v2/vitessshard_types.go b/pkg/apis/planetscale/v2/vitessshard_types.go index e8b0efd0..13af1d7b 100644 --- a/pkg/apis/planetscale/v2/vitessshard_types.go +++ b/pkg/apis/planetscale/v2/vitessshard_types.go @@ -105,7 +105,7 @@ type VitessShardTemplate struct { // TabletPools specify groups of tablets in a given cell with a certain // tablet type and a shared configuration template. // - // There must be at most one pool in this list for each (cell,type,index) set. + // There must be at most one pool in this list for each (cell,type,name) set. // Each shard must have at least one "replica" pool (in at least one cell) // in order to be able to serve. // +patchMergeKey=type @@ -113,7 +113,7 @@ type VitessShardTemplate struct { // +listType=map // +listMapKey=type // +listMapKey=cell - // +listMapKey=index + // +listMapKey=name TabletPools []VitessShardTabletPool `json:"tabletPools,omitempty" patchStrategy:"merge" patchMergeKey:"type"` // DatabaseInitScriptSecret specifies the init_db.sql script file to use for this shard. @@ -171,13 +171,12 @@ type VitessShardTabletPool struct { // +kubebuilder:validation:Enum=replica;rdonly;externalmaster;externalreplica;externalrdonly Type VitessTabletPoolType `json:"type"` - // Index is the pool's index within the (cell,type) pair. - // This field is optional, and defaults to 0. - // Assigning different numbers to this field enables the existence of multiple pools with a specific tablet type in a given cell, + // Name is the pool's unique name within the (cell,type) pair. + // This field is optional, and defaults to an empty. + // Assigning different names to this field enables the existence of multiple pools with a specific tablet type in a given cell, // which can be beneficial for unmanaged tablets. - // +kubebuilder:default=0 - // +kubebuilder:validation:Minimum=0 - Index int32 `json:"index,omitempty"` + // +kubebuilder:default="" + Name string `json:"name,omitempty"` // Replicas is the number of tablets to deploy in this pool. // This field is required, although it may be set to 0, diff --git a/pkg/controller/vitessshard/reconcile_disk.go b/pkg/controller/vitessshard/reconcile_disk.go index 7d95790c..9bdd12ea 100644 --- a/pkg/controller/vitessshard/reconcile_disk.go +++ b/pkg/controller/vitessshard/reconcile_disk.go @@ -133,7 +133,7 @@ func (r *ReconcileVitessShard) claimForTabletPod(ctx context.Context, pod *v1.Po } // tabletKeysForPool returns the list of targetKeys for a given pool type and cell. -// Note that this function does not care about the pool's index assignment. +// Note that this function does not care about the pool's name assignment. func tabletKeysForPool(vts *planetscalev2.VitessShard, poolCell string, poolType planetscalev2.VitessTabletPoolType) ([]string, error) { tabletKeys := vts.Status.TabletAliases() diff --git a/pkg/controller/vitessshard/reconcile_tablets.go b/pkg/controller/vitessshard/reconcile_tablets.go index d995fec1..e8623436 100644 --- a/pkg/controller/vitessshard/reconcile_tablets.go +++ b/pkg/controller/vitessshard/reconcile_tablets.go @@ -284,9 +284,9 @@ func vttabletSpecs(vts *planetscalev2.VitessShard, parentLabels map[string]strin Uid: vttablet.UID(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex)), } - // If TabletPools has multiple pools within the same (cell,type) pair, we need to add a pool index to the UID generator. - if 0 < pool.Index { - tabletAlias.Uid = vttablet.UIDWithPoolIndex(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex), uint32(pool.Index)) + // If TabletPools has multiple pools within the same (cell,type) pair, we need to add a pool name to the UID generator. + if 0 < len(pool.Name) { + tabletAlias.Uid = vttablet.UIDWithPoolName(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex), pool.Name) } // Copy parent labels map and add tablet-specific labels. @@ -297,7 +297,7 @@ func vttabletSpecs(vts *planetscalev2.VitessShard, parentLabels map[string]strin labels[planetscalev2.CellLabel] = tabletAlias.Cell labels[planetscalev2.TabletUidLabel] = strconv.FormatUint(uint64(tabletAlias.Uid), 10) labels[planetscalev2.TabletTypeLabel] = string(pool.Type) - labels[planetscalev2.TabletPoolIndexLabel] = strconv.FormatUint(uint64(pool.Index), 10) + labels[planetscalev2.TabletPoolNameLabel] = pool.Name labels[planetscalev2.TabletIndexLabel] = strconv.FormatUint(uint64(tabletIndex), 10) // Merge ExtraVitessFlags into the tablet spec ExtraFlags field. diff --git a/pkg/operator/vttablet/uid.go b/pkg/operator/vttablet/uid.go index 690a38e1..589c44ad 100644 --- a/pkg/operator/vttablet/uid.go +++ b/pkg/operator/vttablet/uid.go @@ -54,19 +54,19 @@ func UID(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRan } /* -UIDWithPoolIndex function generates a 32-bit unsigned integer similar to the UID function above. +UIDWithPoolName function generates a 32-bit unsigned integer similar to the UID function above. -However, it additionally takes the poolIndex as an input. +However, it additionally takes the poolName as an input. This allows the generation of a unique UID for a tablet that belongs to a different pool but shares other common attributes. To preserve the existing UID, it is recommended to use the UID function instead of this function -when the poolIndex is set to its default value of 0. +when the poolName is set to its default value of an empty string. */ -func UIDWithPoolIndex(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRange, - tabletPoolType planetscalev2.VitessTabletPoolType, tabletIndex uint32, poolIndex uint32) uint32 { +func UIDWithPoolName(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRange, + tabletPoolType planetscalev2.VitessTabletPoolType, tabletName uint32, poolName string) uint32 { h := md5.New() - fmt.Fprintln(h, cellName, keyspaceName, shardKeyRange.String(), string(tabletPoolType), tabletIndex, poolIndex) + fmt.Fprintln(h, cellName, keyspaceName, shardKeyRange.String(), string(tabletPoolType), tabletName, poolName) sum := h.Sum(nil) return binary.BigEndian.Uint32(sum[:4]) } diff --git a/pkg/operator/vttablet/uid_test.go b/pkg/operator/vttablet/uid_test.go index e3e88938..3e05bfec 100644 --- a/pkg/operator/vttablet/uid_test.go +++ b/pkg/operator/vttablet/uid_test.go @@ -39,20 +39,20 @@ func TestUIDHash(t *testing.T) { } } -// TestUIDWithPoolIndexHash checks that nobody changed the hash function for UIDWithPoolIndex(). -func TestUIDWithPoolIndexHash(t *testing.T) { +// TestUIDWithPoolNameHash checks that nobody changed the hash function for UIDWithPoolName(). +func TestUIDWithPoolNameHash(t *testing.T) { cell := "cell" keyspace := "keyspace" keyRange := planetscalev2.VitessKeyRange{Start: "10", End: "20"} tabletType := planetscalev2.ReplicaPoolType - tabletIndex := uint32(1) - poolIndex := uint32(1) + tabletName := uint32(1) + poolName := "unmanaged-replica-1" // DO NOT CHANGE THIS VALUE! // This is intentionally a change-detection test. If it breaks, you messed up. - want := uint32(3840445776) + want := uint32(6333720) - if got := UIDWithPoolIndex(cell, keyspace, keyRange, tabletType, tabletIndex, poolIndex); got != want { - t.Fatalf("UIDWithPoolIndex() = %v, want %v", got, want) + if got := UIDWithPoolName(cell, keyspace, keyRange, tabletType, tabletName, poolName); got != want { + t.Fatalf("UIDWithPoolName() = %v, want %v", got, want) } } diff --git a/test/integration/vitesscluster/vitesscluster_test.go b/test/integration/vitesscluster/vitesscluster_test.go index abc0dc20..f508352b 100644 --- a/test/integration/vitesscluster/vitesscluster_test.go +++ b/test/integration/vitesscluster/vitesscluster_test.go @@ -68,7 +68,7 @@ spec: storage: 1Gi - cell: cell2 type: rdonly - index: 1 + name: unmanaged-replica-2 replicas: 3 mysqld: {} dataVolumeClaimTemplate: @@ -202,19 +202,19 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s // VitessShard creates vttablet Pods. cell1Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell1", "replica", "0"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell1", "replica", ""), }, expectedTabletCount[0]) cell2Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", "0"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", ""), }, expectedTabletCount[1]) cell2_1_Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", "1"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", "unmanaged-replica-2"), }, expectedTabletCount[2]) cell3Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell3", "replica", "0"), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell3", "replica", ""), }, expectedTabletCount[3]) // Each vttablet Pod should have a PVC. @@ -236,7 +236,7 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace, shard, "vtbackup", "init"), &corev1.PersistentVolumeClaim{}) } -func tabletPodSelector(cluster, keyspace, shard, cell, tabletType, poolIndex string) apilabels.Selector { +func tabletPodSelector(cluster, keyspace, shard, cell, tabletType, poolName string) apilabels.Selector { // This intentionally does NOT use any shared constants because we want the // test to fail if the labels change, since that's a breaking change. return apilabels.Set{ @@ -245,6 +245,6 @@ func tabletPodSelector(cluster, keyspace, shard, cell, tabletType, poolIndex str "planetscale.com/shard": shard, "planetscale.com/cell": cell, "planetscale.com/tablet-type": tabletType, - "planetscale.com/pool-index": poolIndex, + "planetscale.com/pool-name": poolName, }.AsSelector() } From 36957219fe4b5338e86e027d232ff244f7b38193 Mon Sep 17 00:00:00 2001 From: Yohei Yoshimuta Date: Wed, 21 Jun 2023 13:05:38 +0900 Subject: [PATCH 3/4] feat: Limit the availability of multiple TabletPool instances to ExternalDatastore Signed-off-by: Yohei Yoshimuta --- docs/api/index.html | 3 +- pkg/apis/planetscale/v2/labels.go | 1 + pkg/apis/planetscale/v2/vitessshard_types.go | 1 + .../vitessshard/reconcile_tablets.go | 6 +- .../vitesscluster/vitesscluster_test.go | 93 ++++++++++++------- 5 files changed, 66 insertions(+), 38 deletions(-) diff --git a/docs/api/index.html b/docs/api/index.html index dfeb3cff..92c2cd3c 100644 --- a/docs/api/index.html +++ b/docs/api/index.html @@ -7075,7 +7075,8 @@

VitessShardTabletPool

Name is the pool’s unique name within the (cell,type) pair. This field is optional, and defaults to an empty. Assigning different names to this field enables the existence of multiple pools with a specific tablet type in a given cell, -which can be beneficial for unmanaged tablets.

+which can be beneficial for unmanaged tablets. +Hence, you must specify ExternalDatastore when assigning a name to this field.

diff --git a/pkg/apis/planetscale/v2/labels.go b/pkg/apis/planetscale/v2/labels.go index 80b8d28b..71c4421e 100644 --- a/pkg/apis/planetscale/v2/labels.go +++ b/pkg/apis/planetscale/v2/labels.go @@ -36,6 +36,7 @@ const ( // TabletTypeLabel is the key for identifying the Vitess target tablet type for a Pod. TabletTypeLabel = LabelPrefix + "/" + "tablet-type" // TabletPoolNameLabel is the key for identifying the Vitess target pool name within the (cell,type) pair. + // This label is applicable to Vitess-unmanaged keyspaces. TabletPoolNameLabel = LabelPrefix + "/" + "pool-name" // TabletIndexLabel is the key for identifying the index of a Vitess tablet within its pool. TabletIndexLabel = LabelPrefix + "/" + "tablet-index" diff --git a/pkg/apis/planetscale/v2/vitessshard_types.go b/pkg/apis/planetscale/v2/vitessshard_types.go index 13af1d7b..e3f0dca8 100644 --- a/pkg/apis/planetscale/v2/vitessshard_types.go +++ b/pkg/apis/planetscale/v2/vitessshard_types.go @@ -175,6 +175,7 @@ type VitessShardTabletPool struct { // This field is optional, and defaults to an empty. // Assigning different names to this field enables the existence of multiple pools with a specific tablet type in a given cell, // which can be beneficial for unmanaged tablets. + // Hence, you must specify ExternalDatastore when assigning a name to this field. // +kubebuilder:default="" Name string `json:"name,omitempty"` diff --git a/pkg/controller/vitessshard/reconcile_tablets.go b/pkg/controller/vitessshard/reconcile_tablets.go index e8623436..2722de2c 100644 --- a/pkg/controller/vitessshard/reconcile_tablets.go +++ b/pkg/controller/vitessshard/reconcile_tablets.go @@ -285,7 +285,7 @@ func vttabletSpecs(vts *planetscalev2.VitessShard, parentLabels map[string]strin } // If TabletPools has multiple pools within the same (cell,type) pair, we need to add a pool name to the UID generator. - if 0 < len(pool.Name) { + if pool.ExternalDatastore != nil && 0 < len(pool.Name) { tabletAlias.Uid = vttablet.UIDWithPoolName(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex), pool.Name) } @@ -297,8 +297,10 @@ func vttabletSpecs(vts *planetscalev2.VitessShard, parentLabels map[string]strin labels[planetscalev2.CellLabel] = tabletAlias.Cell labels[planetscalev2.TabletUidLabel] = strconv.FormatUint(uint64(tabletAlias.Uid), 10) labels[planetscalev2.TabletTypeLabel] = string(pool.Type) - labels[planetscalev2.TabletPoolNameLabel] = pool.Name labels[planetscalev2.TabletIndexLabel] = strconv.FormatUint(uint64(tabletIndex), 10) + if pool.ExternalDatastore != nil { + labels[planetscalev2.TabletPoolNameLabel] = pool.Name + } // Merge ExtraVitessFlags into the tablet spec ExtraFlags field. extraFlags := make(map[string]string) diff --git a/test/integration/vitesscluster/vitesscluster_test.go b/test/integration/vitesscluster/vitesscluster_test.go index f508352b..0483efb8 100644 --- a/test/integration/vitesscluster/vitesscluster_test.go +++ b/test/integration/vitesscluster/vitesscluster_test.go @@ -66,16 +66,6 @@ spec: resources: requests: storage: 1Gi - - cell: cell2 - type: rdonly - name: unmanaged-replica-2 - replicas: 3 - mysqld: {} - dataVolumeClaimTemplate: - accessModes: [ReadWriteOnce] - resources: - requests: - storage: 1Gi - equal: parts: 1 shardTemplate: @@ -87,11 +77,28 @@ spec: type: replica replicas: 3 mysqld: {} - dataVolumeClaimTemplate: - accessModes: [ReadWriteOnce] - resources: - requests: - storage: 1Gi + externalDatastore: + port: 3306 + credentialsSecret: + name: cluster-config + key: db_credentials.json + - cell: cell3 + type: rdonly + replicas: 3 + externalDatastore: + port: 3307 + credentialsSecret: + name: cluster-config + key: db_credentials.json + - cell: cell3 + type: rdonly + replicas: 3 + name: unmanaged-replica-2 + externalDatastore: + port: 3308 + credentialsSecret: + name: cluster-config + key: db_credentials.json backup: locations: - name: vbs1 @@ -191,9 +198,9 @@ func verifyBasicVitessKeyspace(f *framework.Fixture, ns, cluster, keyspace strin f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace), &planetscalev2.VitessKeyspace{}) // VitessKeyspaces create VitessShards. - verifyBasicVitessShard(f, ns, cluster, keyspace, "x-80", []int{3, 3, 3, 0}) - verifyBasicVitessShard(f, ns, cluster, keyspace, "80-x", []int{3, 3, 3, 0}) - verifyBasicVitessShard(f, ns, cluster, keyspace, "x-x", []int{0, 0, 0, 3}) + verifyBasicVitessShard(f, ns, cluster, keyspace, "x-80", []int{3, 3}) + verifyBasicVitessShard(f, ns, cluster, keyspace, "80-x", []int{3, 3}) + verifyBasicVitessShardExternal(f, ns, cluster, keyspace, "x-x", []int{3, 3, 3}) } func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard string, expectedTabletCount []int) { @@ -202,20 +209,12 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s // VitessShard creates vttablet Pods. cell1Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell1", "replica", ""), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell1", "replica"), }, expectedTabletCount[0]) cell2Pods := f.ExpectPods(&client.ListOptions{ Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", ""), + LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly"), }, expectedTabletCount[1]) - cell2_1_Pods := f.ExpectPods(&client.ListOptions{ - Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell2", "rdonly", "unmanaged-replica-2"), - }, expectedTabletCount[2]) - cell3Pods := f.ExpectPods(&client.ListOptions{ - Namespace: ns, - LabelSelector: tabletPodSelector(cluster, keyspace, shard, "cell3", "replica", ""), - }, expectedTabletCount[3]) // Each vttablet Pod should have a PVC. for i := range cell1Pods.Items { @@ -224,19 +223,43 @@ func verifyBasicVitessShard(f *framework.Fixture, ns, cluster, keyspace, shard s for i := range cell2Pods.Items { f.MustGet(ns, cell2Pods.Items[i].Name, &corev1.PersistentVolumeClaim{}) } - for i := range cell2_1_Pods.Items { - f.MustGet(ns, cell2_1_Pods.Items[i].Name, &corev1.PersistentVolumeClaim{}) - } - for i := range cell3Pods.Items { - f.MustGet(ns, cell3Pods.Items[i].Name, &corev1.PersistentVolumeClaim{}) - } // VitessShard creates vtbackup-init Pod/PVC. f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace, shard, "vtbackup", "init"), &corev1.Pod{}) f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace, shard, "vtbackup", "init"), &corev1.PersistentVolumeClaim{}) } -func tabletPodSelector(cluster, keyspace, shard, cell, tabletType, poolName string) apilabels.Selector { +func verifyBasicVitessShardExternal(f *framework.Fixture, ns, cluster, keyspace, shard string, expectedTabletCount []int) { + f.MustGet(ns, names.JoinWithConstraints(names.DefaultConstraints, cluster, keyspace, shard), &planetscalev2.VitessShard{}) + + // VitessShard creates vttablet Pods. + f.ExpectPods(&client.ListOptions{ + Namespace: ns, + LabelSelector: tabletPodExternalSelector(cluster, keyspace, shard, "cell3", "replica", ""), + }, expectedTabletCount[0]) + f.ExpectPods(&client.ListOptions{ + Namespace: ns, + LabelSelector: tabletPodExternalSelector(cluster, keyspace, shard, "cell3", "rdonly", ""), + }, expectedTabletCount[1]) + f.ExpectPods(&client.ListOptions{ + Namespace: ns, + LabelSelector: tabletPodExternalSelector(cluster, keyspace, shard, "cell3", "rdonly", "unmanaged-replica-2"), + }, expectedTabletCount[2]) +} + +func tabletPodSelector(cluster, keyspace, shard, cell, tabletType string) apilabels.Selector { + // This intentionally does NOT use any shared constants because we want the + // test to fail if the labels change, since that's a breaking change. + return apilabels.Set{ + "planetscale.com/cluster": cluster, + "planetscale.com/keyspace": keyspace, + "planetscale.com/shard": shard, + "planetscale.com/cell": cell, + "planetscale.com/tablet-type": tabletType, + }.AsSelector() +} + +func tabletPodExternalSelector(cluster, keyspace, shard, cell, tabletType, poolName string) apilabels.Selector { // This intentionally does NOT use any shared constants because we want the // test to fail if the labels change, since that's a breaking change. return apilabels.Set{ From 62ea41ded28f11b4fa183f6b2a35f7f9c717ecad Mon Sep 17 00:00:00 2001 From: Yohei Yoshimuta Date: Fri, 6 Oct 2023 10:50:46 +0900 Subject: [PATCH 4/4] Fix comment nits Signed-off-by: Yohei Yoshimuta --- pkg/operator/vttablet/uid.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/pkg/operator/vttablet/uid.go b/pkg/operator/vttablet/uid.go index 589c44ad..97f1e374 100644 --- a/pkg/operator/vttablet/uid.go +++ b/pkg/operator/vttablet/uid.go @@ -43,8 +43,7 @@ lead time to develop a smarter way to handle tablet identity and MySQL server IDs in Vitess itself. WARNING: DO NOT change the behavior of this function, as that may result in - - the deletion and recreation of all tablets. + the deletion and recreation of all tablets. */ func UID(cellName, keyspaceName string, shardKeyRange planetscalev2.VitessKeyRange, tabletPoolType planetscalev2.VitessTabletPoolType, tabletIndex uint32) uint32 { h := md5.New()