Skip to content

Commit

Permalink
learner support snapshot RPC (#12890)
Browse files Browse the repository at this point in the history
* learner support snapshot RPC

* CHANGELOG: update for 12890
  • Loading branch information
tangcong authored May 4, 2021
1 parent a3fc535 commit b32bc91
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG-3.5.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ Note that any `etcd_debugging_*` metrics are experimental and subject to change.

- Add [`/v3/auth/status`](https://github.com/etcd-io/etcd/pull/11536) endpoint to check if authentication is enabled
- [Add `Linearizable` field to `etcdserverpb.MemberListRequest`](https://github.com/etcd-io/etcd/pull/11639).
- [Learner support Snapshot RPC](https://github.com/etcd-io/etcd/pull/12890/).

### Package `netutil`

Expand Down
3 changes: 2 additions & 1 deletion server/etcdserver/api/v3rpc/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import (
const (
maxNoLeaderCnt = 3
warnUnaryRequestLatency = 300 * time.Millisecond
snapshotMethod = "/etcdserverpb.Maintenance/Snapshot"
)

type streamsMap struct {
Expand Down Expand Up @@ -214,7 +215,7 @@ func newStreamInterceptor(s *etcdserver.EtcdServer) grpc.StreamServerInterceptor
return rpctypes.ErrGRPCNotCapable
}

if s.IsMemberExist(s.ID()) && s.IsLearner() { // learner does not support stream RPC
if s.IsMemberExist(s.ID()) && s.IsLearner() && info.FullMethod != snapshotMethod { // learner does not support stream RPC except Snapshot
return rpctypes.ErrGPRCNotSupportedForLearner
}

Expand Down

0 comments on commit b32bc91

Please sign in to comment.