-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
cli/user,zone,node: run user
, zone
, node
commands through SQL
#20713
Comments
I would say that once precedent is established, there are some good starter/external contributor projects here. |
I agree for the |
We've talked about a similar idea in the context of the admin UI. I think this is a strategy we should be taking for all of our interfaces -- the same information (and commands?) should be available in comparable form in SQL, with the CLI, through a REST API, and in the Admin UI. That way the user can choose to consume it in whatever form is most convenient for a specific purpose, and knowledge on the use of one interface can transfer to any other as well. |
Precisely - I think it's about time for us to hash this out. A similar exercise has been proposed to basically go through all the cluster settings we expose, etc, and figure out exactly how they should be exposed and why (I might have proposed this...). Is an RFC in order? I had this on my to do list, but obviously 10,000 other things came first before it. I'm happy to take a first crack, but perhaps someone is better suited to do so? |
I haven't checked their size, so if they're already minimal, great 👍 |
@dianasaur323 I'd do a small RFC mostly to get to discuss the tables/commands we want to expose and the fields in each, and how we go about versioning them (if at all). @petermattis yep, The only concrete question I have is whether anyone is opposed to making For powering
These three should be enough to power (a new) That leaves adding commands for @couchand I whole-heartedly agree. I think #20712 is a good issue to talk about in the UI context (where most things are table-scoped; something that doesn't apply in the work scoped out here). |
I wrote this before writing out the rest of the message. Now that I have, I think we should just not commit to versioning at this point since things are likely to be in flux for a bit and nobody has pressed us on it. With that off the table (assuming there's agreement about it), I don't think an RFC is needed though we need to find some way to reduce rot (as new functionality gets introduced). |
@dsaveliev would you be up for adding the Essentially, you need to
|
@tschottdorf yes, I will try to do it. |
@tschottdorf gotcha, will hold off on approaching this more holistically until we get further pressured. that being said, let's make sure @jseldess is aware from a documentation point of view? ah, looking through this a second time, I don't think we need Jesse to do anything. Sorry about that! |
Now that we have the crdb_internal.gossip_* tables, I think we should hook up the The only tricky thing really is that in the response, each thing that you want to make a row ( My idea for that would be to use JSON field types for everything that isn't scalar, but we can check the details when the initial PR is open. I think the schema for the table should be (
and finally StoreStatus: There are a few options here. a) Emit a new row for each entry in the slice. That is, the table will have
I suggest doing c) but I think it's fair to just omit StoreStatuses in the first iteration. |
user
, zone
, node
commands through SQLuser
, zone
, node
commands through SQL
user
, zone
, node
commands through SQLuser
, zone
, node
commands through SQL
Is someone working on this issue? I wanted to work on #16489 , but seems like it would be better to start on that after this is done. |
@Nishant9 I think this is currently waiting for takers! What's left to do here is to use the |
@tschottdorf I think I can pick this up. Can you point me to some file in code where virtual tables are queried( I am assuming there is a better way than using lib/pq to create a postgres connection to cockroach server and then doing the query)? |
Note that |
Earlier `node status` command used to hit statusServer api endpoint and `node ls` internally called `node status`. Now, `node status` and `node ls` commands internally query various tables in crdb_internal and format the result. Closes cockroachdb#20713. Release note: None
Earlier `node status` command used to hit statusServer api endpoint and `node ls` internally called `node status`. Now, `node status` and `node ls` commands internally query various tables in crdb_internal and format the result. Closes cockroachdb#20713. Release note: None
Earlier `node status` command used to hit statusServer api endpoint and `node ls` internally called `node status`. Now, `node status` and `node ls` commands internally query various tables in crdb_internal and format the result. Closes cockroachdb#20713. Release note: None
Earlier `node status` command used to hit statusServer api endpoint and `node ls` internally called `node status`. Now, `node status` and `node ls` commands internally query various tables in crdb_internal and format the result. Closes cockroachdb#20713. Release note: None
25094: cli: run `node status` and `node ls` commands through SQL r=tschottdorf a=Nishant9 Earlier `node status` command used to hit statusServer api endpoint and `node ls` internally called `node status`. After this commit, `node status` and `node ls` commands will internally query various tables in crdb_internal and format the result. Closes #20713. Release note: None 25314: scripts: add a winworker script to create Windows VMs on GCE r=tschottdorf a=benesch It's quite useful to be able to quickly spin up a Windows VM to test our Windows binaries. Release note: None Co-authored-by: Nishant Gupta <[email protected]> Co-authored-by: Nikhil Benesch <[email protected]> Co-authored-by: Tobias Schottdorf <[email protected]>
Most
cli
commands individually query certain endpoints and compile a result which they then pretty-print (see, for example, status node`.This is suboptimal because it implies that certain kind of information is only exposed through the
cli
, and that extra development effort has to be undertaken to make the same status available through SQL when that is requested. Operators are usually able to connect to a cluster using SQL anyway, and using thecli
for the same task may be cumbersome.My proposal is to move the implementation of the
user
,zone
, andnode
commands to SQL wholesale (so that thecli
commands are just small wrappers that issue a SQL query).Some of their information is already available in SQL and the rest should be, and in particular should be presented in a comparable way. For example, the various possible outputs of
./cockroach node status
should be simple joins of more elementary tables incrdb_internal
.Some care has to be taken to make sure that we support returning partial information (#16489). That is, it'd be unfortunate if we joined
crdb_internal.pretty_much_always_available_info_from_gossip
withcrdb_internal.this_only_works_when_cluster_healthy
. But these joins are small, and with just a hint of tooling thecli
can do these in-memory while leaving blanks. Or, we make these tables itself return partial information, though that raises questions about timeouts, etc.The text was updated successfully, but these errors were encountered: