From c78bf655a741b2028349dd7520e85ca6314cbb10 Mon Sep 17 00:00:00 2001 From: Piotr Tabor Date: Mon, 4 Apr 2022 20:33:46 +0200 Subject: [PATCH] Simplify imports and improve comments. --- server/etcdserver/api/v3rpc/header.go | 4 ++-- server/etcdserver/api/v3rpc/watch.go | 6 +++--- server/etcdserver/apply/uber_applier.go | 3 ++- server/etcdserver/server_test.go | 2 +- 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/server/etcdserver/api/v3rpc/header.go b/server/etcdserver/api/v3rpc/header.go index 0ba83ab60..a8f1f92cf 100644 --- a/server/etcdserver/api/v3rpc/header.go +++ b/server/etcdserver/api/v3rpc/header.go @@ -17,13 +17,13 @@ package v3rpc import ( pb "go.etcd.io/etcd/api/v3/etcdserverpb" "go.etcd.io/etcd/server/v3/etcdserver" - apply2 "go.etcd.io/etcd/server/v3/etcdserver/apply" + "go.etcd.io/etcd/server/v3/etcdserver/apply" ) type header struct { clusterID int64 memberID int64 - sg apply2.RaftStatusGetter + sg apply.RaftStatusGetter rev func() int64 } diff --git a/server/etcdserver/api/v3rpc/watch.go b/server/etcdserver/api/v3rpc/watch.go index 543921c04..00b68cdbf 100644 --- a/server/etcdserver/api/v3rpc/watch.go +++ b/server/etcdserver/api/v3rpc/watch.go @@ -26,7 +26,7 @@ import ( "go.etcd.io/etcd/api/v3/v3rpc/rpctypes" "go.etcd.io/etcd/server/v3/auth" "go.etcd.io/etcd/server/v3/etcdserver" - apply2 "go.etcd.io/etcd/server/v3/etcdserver/apply" + "go.etcd.io/etcd/server/v3/etcdserver/apply" "go.etcd.io/etcd/server/v3/storage/mvcc" "go.uber.org/zap" @@ -42,7 +42,7 @@ type watchServer struct { maxRequestBytes int - sg apply2.RaftStatusGetter + sg apply.RaftStatusGetter watchable mvcc.WatchableKV ag AuthGetter } @@ -125,7 +125,7 @@ type serverWatchStream struct { maxRequestBytes int - sg apply2.RaftStatusGetter + sg apply.RaftStatusGetter watchable mvcc.WatchableKV ag AuthGetter diff --git a/server/etcdserver/apply/uber_applier.go b/server/etcdserver/apply/uber_applier.go index e30ef7e86..df94902d1 100644 --- a/server/etcdserver/apply/uber_applier.go +++ b/server/etcdserver/apply/uber_applier.go @@ -104,6 +104,8 @@ func (a *UberApplier) RestoreAlarms() { } func (a *UberApplier) Apply(r *pb.InternalRaftRequest, shouldApplyV3 membership.ShouldApplyV3) *ApplyResult { + // We first execute chain of WrapApply across all objects (e.g. CorruptApplier -> CappedApplier -> Auth -> Quota -> Backend), + // than dispatch(), than individual methods wrappers CorruptApplier.Put(CappedApplier.Put(... BackendApplier.Put()))) return a.applyV3.WrapApply(context.TODO(), r, shouldApplyV3, a.dispatch) } @@ -139,7 +141,6 @@ func (a *UberApplier) dispatch(ctx context.Context, r *pb.InternalRaftRequest, s return nil } - // call into a.s.applyV3.F instead of a.F so upper appliers can check individual calls switch { case r.Range != nil: op = "Range" diff --git a/server/etcdserver/server_test.go b/server/etcdserver/server_test.go index 78cd1b46b..6e344b079 100644 --- a/server/etcdserver/server_test.go +++ b/server/etcdserver/server_test.go @@ -1606,7 +1606,7 @@ func TestUpdateVersion(t *testing.T) { srv := &EtcdServer{ lgMu: new(sync.RWMutex), lg: zaptest.NewLogger(t), - memberId: 1, + memberId: 1, Cfg: config.ServerConfig{Logger: zaptest.NewLogger(t), TickMs: 1, SnapshotCatchUpEntries: DefaultSnapshotCatchUpEntries}, r: *newRaftNode(raftNodeConfig{lg: zaptest.NewLogger(t), Node: n}), attributes: membership.Attributes{Name: "node1", ClientURLs: []string{"http://node1.com"}},