Skip to content

Commit

Permalink
[3.4] backport etcd-io#12890 learner support snapshot RPC
Browse files Browse the repository at this point in the history
Signed-off-by: YaoC <chengyao09@hotmail.com>
  • Loading branch information
tangcong authored and YaoC committed Nov 22, 2023
1 parent 1e75435 commit 4ff558e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion 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
snapshotMethod = "/etcdserverpb.Maintenance/Snapshot"
)

type streamsMap struct {
Expand Down Expand Up @@ -200,7 +201,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 4ff558e

Please sign in to comment.