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

cli: add internal tables to expose status server info about the cluster #21427

Merged
merged 1 commit into from
Jan 16, 2018
Merged

cli: add internal tables to expose status server info about the cluster #21427

merged 1 commit into from
Jan 16, 2018

Conversation

dsaveliev
Copy link
Contributor

Fixes #20713.

Release note: None

@dsaveliev dsaveliev requested review from a team January 12, 2018 22:43
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Member

@tbg tbg left a comment

Choose a reason for hiding this comment

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

Looks good! Thanks for doing this. LGTM after minor nits.

@@ -1613,8 +1621,8 @@ CREATE TABLE crdb_internal.gossip_nodes (
},
}

// crdbInternalGossipLiveness exposes local information about the nodes liveness.
var crdbInternalGossipLiveness = virtualSchemaTable{
Copy link
Member

Choose a reason for hiding this comment

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

nodes' liveness

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shame on me. Fixed.

node_id network address attrs locality version
1 tcp 127.0.0.1:<port> [] · <version>
node_id network address attrs locality server_version
1 tcp 127.0.0.1:<port> [] {} <server_version>

query IITBB colnames
SELECT node_id, epoch, regexp_replace(expiration, '^\d+\.\d+,\d+$', '<timestamp>') as expiration, draining, decommissioning FROM crdb_internal.gossip_liveness WHERE node_id = 1
----
node_id epoch expiration draining decommissioning
1 1 <timestamp> false false

Copy link
Member

Choose a reason for hiding this comment

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

Could you add queries here and below that retrieve things like node_id, store_id, attrs, locality? Those should be static and so we'll see at least some data.

Copy link
Contributor Author

@dsaveliev dsaveliev Jan 15, 2018

Choose a reason for hiding this comment

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

Sure, implemented.
I was confused by the JSON fields. At the moment they are omitted from the tests.

distribution STRING NOT NULL,
type STRING NOT NULL,
dependencies STRING NOT NULL,
started_at INT NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

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

TIMESTAMP

type STRING NOT NULL,
dependencies STRING NOT NULL,
started_at INT NOT NULL,
updated_at INT NOT NULL,
Copy link
Member

Choose a reason for hiding this comment

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

TIMESTAMP

metrics.Add(k, metric)
}

percentilesToJSON := func(ps roachpb.Percentiles) (json.JSON, error) {
Copy link
Member

Choose a reason for hiding this comment

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

@justinj do you think this code is good as is?

Copy link
Contributor

Choose a reason for hiding this comment

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

Assuming it's reasonable that these columns are JSON in the first place (based on a quick glance it looks like it is) the code constructing them looks good to me!

@tbg
Copy link
Member

tbg commented Jan 16, 2018

:lgtm: after my comments!


Reviewed 2 of 4 files at r1, 2 of 2 files at r2.
Review status: all files reviewed at latest revision, 7 unresolved discussions, some commit checks failed.


pkg/sql/crdb_internal.go, line 1745 at r2 (raw file):

}

// crdbInternalKVNodeStatusTable exposes an information from the status server about the cluster nodes.

exposes information


pkg/sql/crdb_internal.go, line 1858 at r2 (raw file):

}

// crdbInternalKVStoreStatusTable exposes an information about the cluster stores.

exposes information


pkg/sql/logictest/testdata/logic_test/crdb_internal, line 243 at r2 (raw file):


query ITTTTTTTTTTT colnames
SELECT node_id, network, regexp_replace(address, '\d+$', '<port>') as address, attrs, locality, regexp_replace(server_version, '^\d+\.\d+(-\d+)?$', '<server_version>') as server_version, regexp_replace(go_version, '^go.+$', '<go_version>') as go_version, tag, time, revision, type, dependencies

tag, time, revision, type, dependencies will all be different. Just remove them 😄


pkg/sql/logictest/testdata/logic_test/crdb_internal, line 254 at r2 (raw file):

----
node_id  store_id  attrs  capacity   available  used  range_count  writes_per_second
1        1         []     536870912  536870912  0     1            0

Remove capacity and available and used; they'll be different in each run. Also remove range_count and writes_per_second; these may differ.


Comments from Reviewable

@dsaveliev dsaveliev requested review from a team January 16, 2018 07:43
@dsaveliev dsaveliev merged commit e521f22 into cockroachdb:master Jan 16, 2018
@a-robinson
Copy link
Contributor

Great stuff, @dsaveliev!

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.

5 participants