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

Add a new field hash_revision into HashKVResponse #14537

Merged
merged 3 commits into from
Nov 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions Documentation/dev-guide/apispec/swagger/rpc.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -2123,6 +2123,11 @@
"type": "integer",
"format": "int64"
},
"hash_revision": {
"description": "hash_revision is the revision up to which the hash is calculated.",
"type": "string",
"format": "int64"
},
"header": {
"$ref": "#/definitions/etcdserverpbResponseHeader"
}
Expand Down
593 changes: 315 additions & 278 deletions api/etcdserverpb/rpc.pb.go

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions api/etcdserverpb/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,8 @@ message HashKVResponse {
uint32 hash = 2;
// compact_revision is the compacted revision of key-value store when hash begins.
int64 compact_revision = 3;
// hash_revision is the revision up to which the hash is calculated.
int64 hash_revision = 4 [(versionpb.etcd_version_field)="3.6"];
}

message HashResponse {
Expand Down
1 change: 1 addition & 0 deletions scripts/etcd_version_annotations.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ etcdserverpb.HashKVRequest.revision: ""
etcdserverpb.HashKVResponse: "3.3"
etcdserverpb.HashKVResponse.compact_revision: ""
etcdserverpb.HashKVResponse.hash: ""
etcdserverpb.HashKVResponse.hash_revision: "3.6"
etcdserverpb.HashKVResponse.header: ""
etcdserverpb.HashRequest: "3.0"
etcdserverpb.HashResponse: "3.0"
Expand Down
7 changes: 6 additions & 1 deletion server/etcdserver/api/v3rpc/maintenance.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,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
}
Expand Down
1 change: 1 addition & 0 deletions server/etcdserver/corrupt.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down