Skip to content

Commit

Permalink
Port OSS changes from perf standby fix (#7818)
Browse files Browse the repository at this point in the history
* Port OSS changes from perf standby fix

* Fix build
  • Loading branch information
briankassouf authored Nov 6, 2019
1 parent d0597bf commit aca342f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 12 deletions.
7 changes: 2 additions & 5 deletions vault/core_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
Expand Down Expand Up @@ -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() {}
Expand Down
8 changes: 3 additions & 5 deletions vault/request_forwarding.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand All @@ -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,
})
}
Expand Down Expand Up @@ -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
}
Expand Down
2 changes: 0 additions & 2 deletions vault/request_forwarding_rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,13 @@ 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 {
core *Core
handler http.Handler
perfStandbySlots chan struct{}
perfStandbyRepCluster *replication.Cluster
perfStandbyCache *cache.Cache
raftFollowerStates *raftFollowerStates
}

Expand Down

0 comments on commit aca342f

Please sign in to comment.