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: fix alignment in node status output #27808

Merged
merged 1 commit into from
Aug 3, 2018

Conversation

neeral
Copy link
Contributor

@neeral neeral commented Jul 20, 2018

See #27807

cockroach node status will hide decommissioning or dead nodes, unless
the user requests all nodes to be shown. The data shown is collected
from two different RPC calls and these do not line up. For example, a
node's liveness will be put together with a different node's
decommission status.

To view this, decommission the node with NodeID 1 in a cluster. Run
cockroach node status --decommission and cockroach node status. Look
at the columns IsLive and UpdatedAt. You'll see they go out of sync.

Release note: None

@neeral neeral requested a review from a team as a code owner July 20, 2018 16:54
@cockroach-teamcity
Copy link
Member

This change is Reviewable

Copy link
Contributor Author

@neeral neeral left a comment

Choose a reason for hiding this comment

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

See issue for evidence of testing

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

Copy link
Contributor Author

@neeral neeral left a comment

Choose a reason for hiding this comment

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

There are no tests for pkg/cli/node.go so I performed manual testing.

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

@knz knz changed the title Fix alignment in node status output cli: fix alignment in node status output Jul 21, 2018
@knz knz requested a review from tbg July 21, 2018 15:13
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.

I'm not confident the code is now correct. Concretely, I think you also have to add to decommissionStatuses when the lop in line 204 decides not to hide the entry.

Could you pull out line 196-220 into a helper that you can then unit test?

@neeral neeral force-pushed the decommission-status-slic branch from b836fc8 to 9a651aa Compare July 26, 2018 01:14
Copy link
Contributor Author

@neeral neeral left a comment

Choose a reason for hiding this comment

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

I've added UT for hideDecommission function. The loop on line 204 didn't seem to affect it. One thing I have noticed is that node statuses that don't have a decommission status is valid (before this PR). Should I exclude such entries (node IDs 5 and 6 in the test)?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained

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.

:lgtm:

I think it's fine to print the nodes which don't have a decommission status. (That's better than removing them or erroring out).

Reviewed 2 of 2 files at r1.
Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)

@knz
Copy link
Contributor

knz commented Jul 26, 2018

@neeral can you please rebase your patch on the latest master branch. Currently it uses a submodule ref that doesn't exist any more.

@neeral neeral force-pushed the decommission-status-slic branch from 9a651aa to 75305b1 Compare July 26, 2018 19:32
@neeral
Copy link
Contributor Author

neeral commented Jul 26, 2018

I've rebased onto the latest release-2.0 branch.

@tbg
Copy link
Member

tbg commented Jul 26, 2018

@knz this PR only merges against release-2.0. The code on master already doesn't have this bug any more.

@neeral neeral force-pushed the decommission-status-slic branch from 75305b1 to 3c2e308 Compare July 26, 2018 20:37
@knz
Copy link
Contributor

knz commented Jul 26, 2018

Yes sorry I meant release-2.0.
The point was that it was using a submodule sha that didn't exist any more. This is now fixed.

@knz
Copy link
Contributor

knz commented Jul 26, 2018

@tschottdorf I'm not reviewing this further. If you're happy, feel free to merge.

@neeral neeral force-pushed the decommission-status-slic branch 2 times, most recently from e2f9dfb to 1d407ed Compare July 27, 2018 23:07
@tbg
Copy link
Member

tbg commented Jul 28, 2018

@neeral there's a flake in the decommission test:

decommission_test.go:338: csv input:
    id,is_live,gossiped_replicas,is_decommissioning,is_draining
    1,true,2,true,false
    id,is_live,gossiped_replicas,is_decommissioning,is_draining
    1,true,0,true,false
    
    All target nodes report that they hold no more data. Please verify cluster health before removing the nodes.
    
    expected:
    [][]string{
        {"id", "is_live", "gossiped_replicas", "is_decommissioning", "is_draining"},
        {"1", "true", "0", "true", "true"},
        {"All target nodes report that they hold no more data. Please verify cluster health before removing the nodes."},
    }
    errors:<nil>
    row #2, col #5: found "false" which does not match "true"

You just have to change the test so that it accepts true|false for the is_draining field.

@neeral neeral force-pushed the decommission-status-slic branch from 1d407ed to 62f363a Compare July 30, 2018 02:58
@tbg
Copy link
Member

tbg commented Jul 31, 2018

bors r+

@craig
Copy link
Contributor

craig bot commented Jul 31, 2018

Build failed

`cockroach node status` will hide decommissioning or dead nodes, unless
the user requests all nodes to be shown. The data shown is collected
from two different RPC calls and these do not line up. For example, a
node's liveness will be put together with a different node's
decommission status.

To view this, decommission the node with NodeID 1 in a cluster. Run
`cockroach node status --decommission` and `cockroach node status`. Look
at the columns IsLive and UpdatedAt. You'll see they go out of sync.

Release note: None
@neeral neeral force-pushed the decommission-status-slic branch from 62f363a to d28ee73 Compare August 1, 2018 17:08
@knz
Copy link
Contributor

knz commented Aug 2, 2018

thanks for the fix

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 2, 2018

Build failed

Copy link
Contributor Author

@neeral neeral left a comment

Choose a reason for hiding this comment

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

@knz @tschottdorf Bors keeps failing but when I run TC build it passes. Is there known flakiness here?
Most recently it failed on acceptance_test:TestJSONBUpgrade which is unrelated to changes I have made.
Could someone re-trigger bors?

Reviewable status: :shipit: complete! 0 of 0 LGTMs obtained (and 1 stale)

@benesch
Copy link
Contributor

benesch commented Aug 3, 2018

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 3, 2018

Timed out

@benesch
Copy link
Contributor

benesch commented Aug 3, 2018

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 3, 2018

Build failed

@benesch
Copy link
Contributor

benesch commented Aug 3, 2018

bors r+

@craig
Copy link
Contributor

craig bot commented Aug 3, 2018

Build failed

@benesch
Copy link
Contributor

benesch commented Aug 3, 2018

bors r+

craig bot pushed a commit that referenced this pull request Aug 3, 2018
27808: cli: fix alignment in `node status` output r=benesch a=neeral

See #27807

`cockroach node status` will hide decommissioning or dead nodes, unless
the user requests all nodes to be shown. The data shown is collected
from two different RPC calls and these do not line up. For example, a
node's liveness will be put together with a different node's
decommission status.

To view this, decommission the node with NodeID 1 in a cluster. Run
`cockroach node status --decommission` and `cockroach node status`. Look
at the columns IsLive and UpdatedAt. You'll see they go out of sync.

Release note: None

Co-authored-by: neeral <[email protected]>
@craig
Copy link
Contributor

craig bot commented Aug 3, 2018

Build succeeded

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