diff --git a/api/etcdserverpb/rpc.pb.go b/api/etcdserverpb/rpc.pb.go index 3ca2b50d4..195c2148a 100644 --- a/api/etcdserverpb/rpc.pb.go +++ b/api/etcdserverpb/rpc.pb.go @@ -275,7 +275,8 @@ type ResponseHeader struct { ClusterId uint64 `protobuf:"varint,1,opt,name=cluster_id,json=clusterId,proto3" json:"cluster_id,omitempty"` // member_id is the ID of the member which sent the response. MemberId uint64 `protobuf:"varint,2,opt,name=member_id,json=memberId,proto3" json:"member_id,omitempty"` - // 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. diff --git a/api/etcdserverpb/rpc.proto b/api/etcdserverpb/rpc.proto index 9d60c0b9e..a9dc1889a 100644 --- a/api/etcdserverpb/rpc.proto +++ b/api/etcdserverpb/rpc.proto @@ -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. diff --git a/etcdctl/ctlv3/command/printer_fields.go b/etcdctl/ctlv3/command/printer_fields.go index 634ea5a8b..4f5cd2a92 100644 --- a/etcdctl/ctlv3/command/printer_fields.go +++ b/etcdctl/ctlv3/command/printer_fields.go @@ -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) }