sql: use SQL sequence as DescIDGenerator for non-system tenants #48513
Labels
A-multitenancy
Related to multi-tenancy
C-enhancement
Solution expected to add code/behavior + preserve backward-compat (pg compat issues are exception)
Relates to #47904.
keys.DescIDGenerator
is currently the only non-SQL key (i.e. no table ID prefix) that non-system tenants in a multi-tenant cluster will need in their keyspace.This presents an interesting conundrum - if we want a per-tenant descriptor ID generator, where do we store it? Do we break down and encode a single non-SQL key under tenant ID-prefixed keys? This seems like a mistake.
Instead, we should explore pulling this
DescIDGenerator
into the SQL-domain properly, but exposing it as a sequence. As it turns out, sequences and theDescIDGenerator
already have the exact same value encoding (they both usekv.IncrementValRetryable
). If we had support for sequences at the time that theDescIDGenerator
was added, we probably would have used them.Proposal:
DescIDSequence
with an ID of 7 for all non-system tenants.keys.DescIDGenerator
when creating the key and when incrementing the key.keys.DescIDGenerator
over.Extended proposal:
keys.DescIDGenerator
over. The timing of this is not pressing, so it could wait out any migration needed for the existing keys in theDeprecatedNamespaceTable
.Note that using ID 7 and placing this sequence in the SystemConfig span is not a concern, because this will range of keys will no longer be gossiped once #47150 is addressed.
The text was updated successfully, but these errors were encountered: