Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keys,roachpb: change default system tenant from tenantID {1} to {2} #133926

Draft
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

cthumuluru-crdb
Copy link
Contributor

By default tenantID {1} is used as system tenant which is prefixless. COCKROACH_EXPERIMENTAL_UA environment variable is used to change the default system tenant from tenantID {1} to {2}.

Copy link

blathers-crl bot commented Oct 31, 2024

It looks like your PR touches production code but doesn't add or edit any test code. Did you consider adding tests to your PR?

🦉 Hoot! I am a Blathers, a bot for CockroachDB. My owner is dev-inf.

@cockroach-teamcity
Copy link
Member

This change is Reviewable

sqlEncoder: sqlEncoder{&MinKey, &MaxKey, roachpb.SystemTenantID},
//
// TODO(chandrat) revisit minKey and maxKeys.
var PrefixlessSystemSQLCodec = SQLCodec{
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be more accurate if we named this:

Suggested change
var PrefixlessSystemSQLCodec = SQLCodec{
var PrefixlessSQLCodec = SQLCodec{

Comment on lines 115 to 134
return id == SystemTenantID.ToUint64()
return id == TenantTwo.ToUint64() || id == TenantOne.ToUint64()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps this new logic should only take place if we have the env var set?

By default tenantID {1} is used as system tenant which is prefixless.
`COCKROACH_EXPERIMENTAL_UA` environment variable is used to change
the default system tenant from tenantID {1} to {2}.
shubhamdhama and others added 2 commits November 14, 2024 16:48
When we start the `TenantTwo` we want it to have `system` as its name from
the very beginning. To achieve this, instead of rewriting keys we use
KVWriter. `TenantTwo`'s name would become `system`, and `TenantOne`'s name
would be whatever is passed to `create_tenant` command (ideally, `main`).
Note, we are chaning this value for `TenantTwo`'s `tenants` table, not for
the `TenantOne`'s system table.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants