From c56485ce89135b5495aa82547222906a31d84faa Mon Sep 17 00:00:00 2001 From: Benjamin Wang Date: Thu, 29 Sep 2022 10:52:57 +0800 Subject: [PATCH] etcdserver: populate HashRevision when responding to leader or client's HashKV request Signed-off-by: Benjamin Wang --- server/etcdserver/api/v3rpc/maintenance.go | 7 ++++++- server/etcdserver/corrupt.go | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/etcdserver/api/v3rpc/maintenance.go b/server/etcdserver/api/v3rpc/maintenance.go index f8b61d3f9fd4..f22ab6b22d0e 100644 --- a/server/etcdserver/api/v3rpc/maintenance.go +++ b/server/etcdserver/api/v3rpc/maintenance.go @@ -208,7 +208,12 @@ func (ms *maintenanceServer) HashKV(ctx context.Context, r *pb.HashKVRequest) (* return nil, togRPCError(err) } - resp := &pb.HashKVResponse{Header: &pb.ResponseHeader{Revision: rev}, Hash: h.Hash, CompactRevision: h.CompactRevision} + resp := &pb.HashKVResponse{ + Header: &pb.ResponseHeader{Revision: rev}, + Hash: h.Hash, + CompactRevision: h.CompactRevision, + HashRevision: h.Revision, + } ms.hdr.fill(resp.Header) return resp, nil } diff --git a/server/etcdserver/corrupt.go b/server/etcdserver/corrupt.go index fe68a2965741..7b72124e670b 100644 --- a/server/etcdserver/corrupt.go +++ b/server/etcdserver/corrupt.go @@ -448,6 +448,7 @@ func (h *hashKVHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { Header: &pb.ResponseHeader{Revision: rev}, Hash: hash.Hash, CompactRevision: hash.CompactRevision, + HashRevision: hash.Revision, } respBytes, err := json.Marshal(resp) if err != nil {