mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-08-28 10:54:59 +00:00
make behavior equivalent to pre-change to stop test from failing
This commit is contained in:
parent
33b3a14b24
commit
69b1f2ea97
3 changed files with 13 additions and 18 deletions
|
|
@ -1803,9 +1803,6 @@ func (c *Cluster) mergeClusterStatus(cs *internal.ClusterStatus) error {
|
|||
}
|
||||
|
||||
func (c *Cluster) setStatic(hosts []string) error {
|
||||
if len(hosts) == 0 {
|
||||
return errors.New("must specify at least one host")
|
||||
}
|
||||
c.Static = true
|
||||
c.Coordinator = c.Node.ID
|
||||
for _, address := range hosts {
|
||||
|
|
|
|||
22
server.go
22
server.go
|
|
@ -52,12 +52,13 @@ type Server struct {
|
|||
closing chan struct{}
|
||||
|
||||
// Internal
|
||||
Holder *Holder
|
||||
Cluster *Cluster
|
||||
TranslateFile *TranslateFile
|
||||
diagnostics *DiagnosticsCollector
|
||||
executor *Executor
|
||||
hosts []string
|
||||
Holder *Holder
|
||||
Cluster *Cluster
|
||||
TranslateFile *TranslateFile
|
||||
diagnostics *DiagnosticsCollector
|
||||
executor *Executor
|
||||
hosts []string
|
||||
clusterDisabled bool
|
||||
|
||||
// External
|
||||
handler Handler
|
||||
|
|
@ -208,11 +209,12 @@ func OptServerURI(uri *URI) ServerOption {
|
|||
}
|
||||
}
|
||||
|
||||
// OptClusterStatic tells the server to use a static cluster with the defined
|
||||
// hosts. Mostly used for testing.
|
||||
func OptServerClusterStatic(hosts []string) ServerOption {
|
||||
// OptClusterDisabled tells the server whether to use a static cluster with the
|
||||
// defined hosts. Mostly used for testing.
|
||||
func OptServerClusterDisabled(disabled bool, hosts []string) ServerOption {
|
||||
return func(s *Server) error {
|
||||
s.hosts = hosts
|
||||
s.clusterDisabled = disabled
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
|
@ -282,7 +284,7 @@ func NewServer(opts ...ServerOption) (*Server, error) {
|
|||
IsCoordinator: s.Cluster.Coordinator == s.NodeID,
|
||||
}
|
||||
s.Cluster.Node = node
|
||||
if len(s.hosts) > 0 {
|
||||
if s.clusterDisabled {
|
||||
err := s.Cluster.setStatic(s.hosts)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "setting cluster static")
|
||||
|
|
|
|||
|
|
@ -209,10 +209,6 @@ func (m *Command) SetupServer() error {
|
|||
if err != nil {
|
||||
return errors.Wrap(err, "new stats client")
|
||||
}
|
||||
var hosts []string
|
||||
if m.Config.Cluster.Disabled {
|
||||
hosts = m.Config.Cluster.Hosts
|
||||
}
|
||||
|
||||
ln, err := getListener(*uri, TLSConfig)
|
||||
if err != nil {
|
||||
|
|
@ -246,7 +242,7 @@ func (m *Command) SetupServer() error {
|
|||
pilosa.OptServerURI(uri),
|
||||
pilosa.OptServerInternalClient(http.NewInternalClientFromURI(uri, c)),
|
||||
pilosa.OptServerPrimaryTranslateStore(primaryTranslateStore),
|
||||
pilosa.OptServerClusterStatic(hosts),
|
||||
pilosa.OptServerClusterDisabled(m.Config.Cluster.Disabled, m.Config.Cluster.Hosts),
|
||||
)
|
||||
|
||||
return errors.Wrap(err, "new server")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue