Skip to content

Commit

Permalink
Merge pull request #14033 from ahrtr/hide_revision
Browse files Browse the repository at this point in the history
Hide the revision field when it isn't populated
  • Loading branch information
ahrtr authored May 13, 2022
2 parents 29f090b + beeb44d commit 7ec336f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
3 changes: 2 additions & 1 deletion api/etcdserverpb/rpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion api/etcdserverpb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,8 @@ message ResponseHeader {
uint64 cluster_id = 1;
// member_id is the ID of the member which sent the response.
uint64 member_id = 2;
// revision is the key-value store revision when the request was applied.
// revision is the key-value store revision when the request was applied, and it's
// unset (so 0) in case of calls not interacting with key-value store.
// For watch progress responses, the header.revision indicates progress. All future events
// received in this stream are guaranteed to have a higher revision number than the
// header.revision number.
Expand Down
7 changes: 6 additions & 1 deletion etcdctl/ctlv3/command/printer_fields.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,12 @@ func (p *fieldsPrinter) kv(pfx string, kv *spb.KeyValue) {
func (p *fieldsPrinter) hdr(h *pb.ResponseHeader) {
fmt.Println(`"ClusterID" :`, h.ClusterId)
fmt.Println(`"MemberID" :`, h.MemberId)
fmt.Println(`"Revision" :`, h.Revision)
// Revision only makes sense for k/v responses. For other kinds of
// responses, i.e. MemberList, usually the revision isn't populated
// at all; so it would be better to hide this field in these cases.
if h.Revision > 0 {
fmt.Println(`"Revision" :`, h.Revision)
}
fmt.Println(`"RaftTerm" :`, h.RaftTerm)
}

Expand Down

0 comments on commit 7ec336f

Please sign in to comment.