cockroachdb / cockroach

CockroachDB — the cloud native, distributed SQL database designed for high availability, effortless scale, and control over data placement.
https://www.cockroachlabs.com
Other
29.87k stars 3.77k forks source link

server,sql: Remove `OptionalNodesStatusServer` usage from `crdb_internal.kv_{node_status,store_status}` #128887

Open shubhamdhama opened 1 month ago

shubhamdhama commented 1 month ago

Describe the problem

As part of https://github.com/cockroachdb/cockroach/issues/100826, we are removing usages of OptionalNodesStatusServer.

To Reproduce

Current behavior: For secondary tenants:

demo@127.0.0.1:26257/demoapp/movr> select * from crdb_internal.kv_node_status;
ERROR: unimplemented: operation is unsupported within a virtual cluster
SQLSTATE: 0A000
HINT: You have attempted to use a feature that is not yet implemented.
See: https://go.crdb.dev/issue-v/54252/v24.2

For system tenants, it works (can't paste the output, it prints a ton).

Approach

If we want to limit the usage to system tenants only, we can use codec.ForSystemTenant and return a more user-friendly message, similar to what we do for show virtual clusters:

ERROR: only the system tenant can show other tenants
SQLSTATE: 42501
HINT: Connect to the system interface and manage tenants from there.

On the other hand, if we want secondary tenants to use this feature as well, we might need to build some connector or bridge.

Jira issue: CRDB-41258

blathers-crl[bot] commented 1 month ago

Hi @shubhamdhama, please add branch-* labels to identify which branch(es) this C-bug affects.

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