Use case
Creating distinct tablet pools of the same type, to create distinct configurations for tablets in the same Keyspace - ie. migrating from one volumeClaimTemplate to another.
Issue
I have a keyspace with 2 tablet pools - default (replica) and reporting (rdonly). This works fine.
I added a third tablet pool local, of type replica again (different volumeClaimTemplate and some labels distinct to the tablet pool) with a single replica (default x3, local x1) but when the operator applies the change, it instead scaled down a tablet from the default pool, leaving me with default x2, local x1. This happened again when I tried to scale up to local x2 resulting in default x2, local x2.
Root cause
It looks like the pool's name is only factored into the generation of the tablet UID when ExternalDatastore = true. This means that the 2x tablet pools' replicas are getting the same UIDs across the pools (based on their replica index), and as such are overwriting one-another.
|
// If TabletPools has multiple pools within the same (cell,type) pair, we need to add a pool name to the UID generator. |
|
if pool.ExternalDatastore != nil && 0 < len(pool.Name) { |
|
tabletAlias.Uid = vttablet.UIDWithPoolName(pool.Cell, keyspaceName, vts.Spec.KeyRange, pool.Type, uint32(tabletIndex), pool.Name) |
|
} |
However, the docs say There must be at most one pool in this list for each (cell,type,name), which leads me to think that the if ExternalDatastore != nil condition can be removed?
Version
Operator: v2.14.0
Vitess: v21.0.3
Looking at the source, this is still the same in main
I didn't see an issue template so I tried to include what I though what was relevant - Happy to provide more info here or on Slack.
Use case
Creating distinct tablet pools of the same type, to create distinct configurations for tablets in the same Keyspace - ie. migrating from one
volumeClaimTemplateto another.Issue
I have a keyspace with 2 tablet pools -
default(replica) andreporting(rdonly). This works fine.I added a third tablet pool
local, of typereplicaagain (differentvolumeClaimTemplateand some labels distinct to the tablet pool) with a single replica (defaultx3,localx1) but when the operator applies the change, it instead scaled down a tablet from thedefaultpool, leaving me withdefaultx2,localx1. This happened again when I tried to scale up tolocalx2 resulting indefaultx2,localx2.Root cause
It looks like the pool's
nameis only factored into the generation of the tablet UID whenExternalDatastore = true. This means that the 2x tablet pools' replicas are getting the same UIDs across the pools (based on their replica index), and as such are overwriting one-another.vitess-operator/pkg/controller/vitessshard/reconcile_tablets.go
Lines 287 to 290 in 2d43a0d
However, the docs say
There must be at most one pool in this list for each (cell,type,name), which leads me to think that theif ExternalDatastore != nilcondition can be removed?Version
Operator: v2.14.0
Vitess: v21.0.3
Looking at the source, this is still the same in
mainI didn't see an issue template so I tried to include what I though what was relevant - Happy to provide more info here or on Slack.