learner support snapshot RPC (#12890)

* learner support snapshot RPC

* CHANGELOG: update for 12890
This commit is contained in:
tangcong 2021-05-05 04:26:33 +08:00 committed by GitHub
parent a3fc535a5a
commit b32bc914ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 1 deletions

View File

@ -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`

View File

@ -35,6 +35,7 @@ import (
const (
maxNoLeaderCnt = 3
warnUnaryRequestLatency = 300 * time.Millisecond
snapshotMethod = "/etcdserverpb.Maintenance/Snapshot"
)
type streamsMap struct {
@ -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
}