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

Display hash_revision for etcdctl endpoint hash #14812

Merged
merged 5 commits into from
Nov 25, 2022

Conversation

ahrtr
Copy link
Member

@ahrtr ahrtr commented Nov 21, 2022

The server side change is done in #14537.

This PR is the etcdctl side change, and also cover the test.

Please read https://github.com/etcd-io/etcd/blob/main/CONTRIBUTING.md#contribution-flow.

@ahrtr ahrtr force-pushed the add_hash_revision_etcdctl_20221121 branch from d9a085b to 10bceba Compare November 21, 2022 00:46
@codecov-commenter
Copy link

codecov-commenter commented Nov 21, 2022

Codecov Report

Merging #14812 (33d9303) into main (9cc2f64) will decrease coverage by 0.24%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##             main   #14812      +/-   ##
==========================================
- Coverage   75.64%   75.40%   -0.25%     
==========================================
  Files         457      457              
  Lines       37391    37393       +2     
==========================================
- Hits        28284    28195      -89     
- Misses       7336     7415      +79     
- Partials     1771     1783      +12     
Flag Coverage Δ
all 75.40% <0.00%> (-0.25%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
etcdctl/ctlv3/command/printer.go 33.33% <0.00%> (-0.27%) ⬇️
etcdctl/ctlv3/command/printer_fields.go 6.06% <0.00%> (-0.04%) ⬇️
server/proxy/grpcproxy/auth.go 44.44% <0.00%> (-44.45%) ⬇️
server/proxy/grpcproxy/maintenance.go 45.45% <0.00%> (-36.37%) ⬇️
server/etcdserver/api/v3rpc/interceptor.go 73.43% <0.00%> (-9.38%) ⬇️
client/v3/concurrency/session.go 88.63% <0.00%> (-4.55%) ⬇️
server/etcdserver/api/rafthttp/msgappv2_codec.go 71.30% <0.00%> (-3.48%) ⬇️
client/v3/leasing/txn.go 88.09% <0.00%> (-3.18%) ⬇️
server/proxy/grpcproxy/cluster.go 74.35% <0.00%> (-2.57%) ⬇️
client/v3/concurrency/election.go 79.68% <0.00%> (-2.35%) ⬇️
... and 16 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@ahrtr
Copy link
Member Author

ahrtr commented Nov 21, 2022

Some examples output.

$ ./etcdctl endpoint hash --cluster -w table
+------------------------+------------+----------+
|        ENDPOINT        |    HASH    | REVISION |
+------------------------+------------+----------+
|  http://127.0.0.1:2379 | 2064120424 |       13 |
| http://127.0.0.1:22379 | 2064120424 |       13 |
| http://127.0.0.1:32379 | 2064120424 |       13 |
+------------------------+------------+----------+
$ ./etcdctl endpoint hash --cluster -w fields
"ClusterID" : 17237436991929493444
"MemberID" : 9372538179322589801
"Revision" : 13
"RaftTerm" : 2
"Endpoint" : "http://127.0.0.1:2379"
"Hash" : 2064120424
"HashRevision" : 13

"ClusterID" : 17237436991929493444
"MemberID" : 10501334649042878790
"Revision" : 13
"RaftTerm" : 2
"Endpoint" : "http://127.0.0.1:22379"
"Hash" : 2064120424
"HashRevision" : 13

"ClusterID" : 17237436991929493444
"MemberID" : 18249187646912138824
"Revision" : 13
"RaftTerm" : 2
"Endpoint" : "http://127.0.0.1:32379"
"Hash" : 2064120424
"HashRevision" : 13
$ ./etcdctl endpoint hash --cluster -w simple
http://127.0.0.1:2379, 2064120424, 13
http://127.0.0.1:22379, 2064120424, 13
http://127.0.0.1:32379, 2064120424, 13
$ ./etcdctl endpoint hash --cluster -w json | jq
[
  {
    "Endpoint": "http://127.0.0.1:2379",
    "HashKV": {
      "header": {
        "cluster_id": 17237436991929494000,
        "member_id": 9372538179322590000,
        "revision": 13,
        "raft_term": 2
      },
      "hash": 2064120424,
      "compact_revision": -1,
      "hash_revision": 13
    }
  },
  {
    "Endpoint": "http://127.0.0.1:22379",
    "HashKV": {
      "header": {
        "cluster_id": 17237436991929494000,
        "member_id": 10501334649042878000,
        "revision": 13,
        "raft_term": 2
      },
      "hash": 2064120424,
      "compact_revision": -1,
      "hash_revision": 13
    }
  },
  {
    "Endpoint": "http://127.0.0.1:32379",
    "HashKV": {
      "header": {
        "cluster_id": 17237436991929494000,
        "member_id": 18249187646912140000,
        "revision": 13,
        "raft_term": 2
      },
      "hash": 2064120424,
      "compact_revision": -1,
      "hash_revision": 13
    }
  }
]

@ahrtr ahrtr force-pushed the add_hash_revision_etcdctl_20221121 branch from b239362 to 33d9303 Compare November 21, 2022 22:10
@ahrtr
Copy link
Member Author

ahrtr commented Nov 21, 2022

Rebased this PR and updated the examples for etcdctl endpoint hashkv command in etcdctl readme.md.

@ahrtr
Copy link
Member Author

ahrtr commented Nov 22, 2022

cc @ptabor @serathius @spzala

Copy link
Contributor

@ptabor ptabor left a comment

Choose a reason for hiding this comment

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

Thank you. Just a few nits.

etcdctl/README.md Show resolved Hide resolved
etcdctl/ctlv3/command/printer.go Outdated Show resolved Hide resolved
etcdctl/README.md Outdated Show resolved Hide resolved
Two chanages:
1. Add field `HashRevision` into `HashKVResponse`;
2. Display the new field when executing `etcdctl endpoint hash`.

Signed-off-by: Benjamin Wang <[email protected]>
@ahrtr ahrtr force-pushed the add_hash_revision_etcdctl_20221121 branch from 33d9303 to 9a7f960 Compare November 25, 2022 11:03
@ahrtr ahrtr merged commit 488e541 into etcd-io:main Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants