return 0 values for errors. panic on unmarshal node meta data

This commit is contained in:
Travis Turner 2018-02-02 15:58:08 -06:00
parent 86dbbbf393
commit 346e92a91d
No known key found for this signature in database
GPG key ID: 7F08008DFD9314C9
2 changed files with 4 additions and 5 deletions

View file

@ -633,12 +633,12 @@ func (c *Cluster) diff(other *Cluster) (action string, nodeID string, err error)
lenTo := len(other.Nodes)
// Determine if a node is being added or removed.
if lenFrom == lenTo {
return action, nodeID, errors.New("clusters are the same size")
return "", "", errors.New("clusters are the same size")
}
if lenFrom < lenTo {
// Adding a node.
if lenTo-lenFrom > 1 {
return action, nodeID, errors.New("adding more than one node at a time is not supported")
return "", "", errors.New("adding more than one node at a time is not supported")
}
action = ResizeJobActionAdd
// Determine the node ID that is being added.
@ -651,7 +651,7 @@ func (c *Cluster) diff(other *Cluster) (action string, nodeID string, err error)
} else if lenFrom > lenTo {
// Removing a node.
if lenFrom-lenTo > 1 {
return action, nodeID, errors.New("removing more than one node at a time is not supported")
return "", "", errors.New("removing more than one node at a time is not supported")
}
action = ResizeJobActionRemove
// Determine the node ID that is being removed.

View file

@ -384,8 +384,7 @@ func (g *GossipEventReceiver) listen() {
// Get the node from the event.Node meta data.
var n internal.Node
if err := proto.Unmarshal(e.Node.Meta, &n); err != nil {
// TODO: consider logging error
continue
panic("failed to unmarshal event node meta data")
}
node := pilosa.DecodeNode(&n)