From 839cfa4193fd37f38697f6526cd286bd5c3a856a Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Wed, 6 Nov 2019 14:27:36 -0800 Subject: [PATCH 1/2] Port OSS changes from perf standby fix --- vault/request_forwarding.go | 8 +++----- vault/request_forwarding_rpc.go | 2 -- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/vault/request_forwarding.go b/vault/request_forwarding.go index 26e3fa5da90f..b97263e6ded4 100644 --- a/vault/request_forwarding.go +++ b/vault/request_forwarding.go @@ -20,7 +20,6 @@ import ( "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/vault/cluster" "github.com/hashicorp/vault/vault/replication" - cache "github.com/patrickmn/go-cache" "golang.org/x/net/http2" "google.golang.org/grpc" "google.golang.org/grpc/keepalive" @@ -41,7 +40,7 @@ type requestForwardingClusterClient struct { // NewRequestForwardingHandler creates a cluster handler for use with request // forwarding. -func NewRequestForwardingHandler(c *Core, fws *http2.Server, perfStandbySlots chan struct{}, perfStandbyRepCluster *replication.Cluster, perfStandbyCache *cache.Cache) (*requestForwardingHandler, error) { +func NewRequestForwardingHandler(c *Core, fws *http2.Server, perfStandbySlots chan struct{}, perfStandbyRepCluster *replication.Cluster) (*requestForwardingHandler, error) { // Resolve locally to avoid races ha := c.ha != nil @@ -59,7 +58,6 @@ func NewRequestForwardingHandler(c *Core, fws *http2.Server, perfStandbySlots ch handler: c.clusterHandler, perfStandbySlots: perfStandbySlots, perfStandbyRepCluster: perfStandbyRepCluster, - perfStandbyCache: perfStandbyCache, raftFollowerStates: c.raftFollowerStates, }) } @@ -194,12 +192,12 @@ func (c *Core) startForwarding(ctx context.Context) error { return nil } - perfStandbyRepCluster, perfStandbyCache, perfStandbySlots, err := c.perfStandbyClusterHandler() + perfStandbyRepCluster, perfStandbySlots, err := c.perfStandbyClusterHandler() if err != nil { return err } - handler, err := NewRequestForwardingHandler(c, c.getClusterListener().Server(), perfStandbySlots, perfStandbyRepCluster, perfStandbyCache) + handler, err := NewRequestForwardingHandler(c, c.getClusterListener().Server(), perfStandbySlots, perfStandbyRepCluster) if err != nil { return err } diff --git a/vault/request_forwarding_rpc.go b/vault/request_forwarding_rpc.go index 8db60be3d14b..4812fb436ac0 100644 --- a/vault/request_forwarding_rpc.go +++ b/vault/request_forwarding_rpc.go @@ -11,7 +11,6 @@ import ( "github.com/hashicorp/vault/physical/raft" "github.com/hashicorp/vault/sdk/helper/consts" "github.com/hashicorp/vault/vault/replication" - cache "github.com/patrickmn/go-cache" ) type forwardedRequestRPCServer struct { @@ -19,7 +18,6 @@ type forwardedRequestRPCServer struct { handler http.Handler perfStandbySlots chan struct{} perfStandbyRepCluster *replication.Cluster - perfStandbyCache *cache.Cache raftFollowerStates *raftFollowerStates } From 369d3e32669e24f5effd21be59c039922db837e7 Mon Sep 17 00:00:00 2001 From: Brian Kassouf Date: Wed, 6 Nov 2019 14:32:17 -0800 Subject: [PATCH 2/2] Fix build --- vault/core_util.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/vault/core_util.go b/vault/core_util.go index 11ea223932f9..192eaebedd6f 100644 --- a/vault/core_util.go +++ b/vault/core_util.go @@ -4,15 +4,12 @@ package vault import ( "context" - "time" "github.com/hashicorp/vault/helper/namespace" "github.com/hashicorp/vault/sdk/helper/license" "github.com/hashicorp/vault/sdk/logical" "github.com/hashicorp/vault/sdk/physical" - "github.com/hashicorp/vault/vault/cluster" "github.com/hashicorp/vault/vault/replication" - cache "github.com/patrickmn/go-cache" ) type entCore struct{} @@ -119,8 +116,8 @@ func (c *Core) removePerfStandbySecondary(context.Context, string) {} func (c *Core) removeAllPerfStandbySecondaries() {} -func (c *Core) perfStandbyClusterHandler() (*replication.Cluster, *cache.Cache, chan struct{}, error) { - return nil, cache.New(2*cluster.HeartbeatInterval, 1*time.Second), make(chan struct{}), nil +func (c *Core) perfStandbyClusterHandler() (*replication.Cluster, chan struct{}, error) { + return nil, make(chan struct{}), nil } func (c *Core) initSealsForMigration() {}